Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Auto-Insertion quotes not auto-inserting when adjacent character is present

    Help wanted · · · – – – · · ·
    2
    2
    1812
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • CatPurrfect
      CatPurrfect last edited by

      So for example in HTML if I were to write "<html lang=“en-US”> when I type the first quote it doesn’t automatically insert the second one following it. It is enabled in the settings. However weirdly if I were to write <html lang=[en-US]> the brackets successfully auto-insert (this also works with () and {}). However even weirder is that the quotes problem is only present when adjacent to either side by another character. If I were to type " with no adjacent characters nearby it will auto-insert the other double quote. So this problem is only affecting the quotes. If someone could help me I’d greatly appreciate it, thanks.

      Claudia Frank 1 Reply Last reply Reply Quote 0
      • Claudia Frank
        Claudia Frank @CatPurrfect last edited by

        @CatPurrfect

        unfortunately it looks like a bug.
        A “per npp start” workaround is to uncheck the default quote in settings dialog and define it as user defined,
        but as soon as you restart it doesn’t work again.
        Another solution might be to use a python script to do the auto inserts.
        Could look like this

        dict_complete_char = {'"':'"','(':')','{':'}'}
        
        def callback_CHARADDED(args):
        
            if(args.has_key('ch')):
                if dict_complete_char.get(chr(args['ch'])):
                    editor.insertText(editor.getCurrentPos(), dict_complete_char.get(chr(args['ch'])))
             
            
        editor.clearCallbacks([SCINTILLANOTIFICATION.CHARADDED]);
        editor.callback(callback_CHARADDED, [SCINTILLANOTIFICATION.CHARADDED])              
        

        In dict_complete_char you would define the pairs which should be inserted.

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Copyright © 2014 NodeBB Forums | Contributors