Community
    • Login

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

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 2.0k Views
    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.
    • CatPurrfectC
      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 FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        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
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors