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



  • 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.



  • @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


Log in to reply