Auto insert broken?



  • I’m sorry if this has been addressed already, but I can’t seem to find anything on it.

    In previous versions prior to 6.8.3 or so, typing a left-hand character included in the Settings>Auto-insert section ALWAYS added the right-hand closing character (braces, quotes, parentheses, etc.). Now it doesn’t under certain circumstances, such as when there are characters to the right of the cursor.

    This change in behavior has caused no end of problems for me as I’ve been ‘trained’ that when I type an opening brace, the closing one automatically appears. I’ve had to revert to 6.8.3 to restore expected behavior.

    Is this a bug, or new improved (not, imho) behavior?



  • Hello @Steve-Johnson,

    you are right, this has been introduced with npp6.8.4.
    It was aksed to enhance this to prevent deleting unecessary chars.
    Let’s assume there is text like

    some text and we want to encase it by brackets
    

    prior to 6.8.4 inserting a bracket would result in

    some text and we want to []encase[] it by brackets
    

    when only

    some text and we want to [encase] it by brackets
    

    was wanted.
    But this resulted in behaviour like

    cstr(int()
    

    whereas

    cstr(int())
    

    is wanted.

    I guess this is one of those decisions which needs to be made, support either this or that. And if it could be solved
    to make you and the requestors of this enhancment happy, I’m pretty sure another party comes up and wants something different.

    But, the beauty is, npp is open source and you can download the source and modify it to your needs or, as you already did,
    use 6.8.3 from the archive.

    Cheers
    Claudia



  • Thank you for the explanation, Claudia.

    As modifying the source code to my needs is beyond my capabilities, I guess I am stuck with 6.8.3 for the time being while looking around for another code editor.



  • Hello Steve,

    there is another way to do it but this involves python script plugin.
    You can read here what needs to be done.

    Cheers
    Claudia



  • Hello Steve, Claudia and All,

    May be an option to enable/disable the “intelligent” auto-insert feature ( introduced since N++ 6.8.4 ) would be judicious, in the Settings - Preferences - Auto-Completion - Auto-Insert area ?

    So, when this option is UNCHECKED, we would find, again, the old auto-insert behaviour !

    I suppose that, by-passing the part of code that produces the new behaviour, in order to get the old automatic auto-insert behaviour, shouldn’t be too difficult to code, anyway !

    Of course, it’s up to Don Ho and/or the devs, which coded the auto-insert feature

    Best Regards,

    guy038


Log in to reply