Control+B does not work correctly. Why?



  • I am a new user with Notepad++, and I have a vhd file and following statement:

    Accept_O(0) <= D0_I and ((not D1_I_First and (not A0_Valid or A0_Go)) 
    	or (D1_I_First and (not A1_Valid or A1_Go)));
    

    When I press Ctrl+B, in forward direction it works correctly, but in backward direction, it sometimes work, sometimes doesn’t for two continuous “))”. If it is “) )” with a space added between the two continuous “))”, it always works.

    I position the cursor on a ‘(’, press Ctrl+B twice, the cursor should return to the starting place, but sometimes it does not work.

    Very troublesome!

    Weng



  • welcome to the notepad++ community, @W-TX

    this issue exists in older and newer versions of notepad++.

    currently the only way i know, to get ctrl+b (go to matching brace) working on your given example, is by installing the textfx plugin (officially only available for 32 bit) as it includes a fix for this problem.

    without textfx, notepad++ is currently not able to correctly jump to the matching closing bracket on consecutive multiple brackets.

    best regards.



  • I did some testing - seems like the simple fix is to advance one space after Ctrl+B to put the cursor on the “outside” of the closing parenthesis, brace, bracket. I wonder if that could be done by remapping Ctrl+B to a PythonScript or LuaScript?



  • In fact, you could create this NppExec script and map it to Ctrl+B - removing the current Ctrl+B shortcut:

    NPP_CONSOLE keep
    SCI_SENDMSG SCI_GETCURRENTPOS
    SCI_SENDMSG SCI_BRACEMATCH $(MSG_RESULT)
    SET POSITION ~ $(MSG_RESULT) + 2
    SCI_SENDMSG SCI_GOTOPOS $(POSITION)



  • @Michael-Vincent

    IMO that isn’t a great solution either because, when you repeat the operation, without first moving the caret manually, you should again end up where you start. And in the case of your NppExec script, and the OP’s original text, that doesn’t happen when you start with your insert caret just to the left of ((not.


Log in to reply