The Insert Matching Bracket command is only available when bracket matching is enabled on the Brackets page in the file type configuration for the active file’s file type. The syntax coloring scheme determines exactly which brackets are matched. See that section in this help file to learn how bracket matching works in EditPad Pro.
Just like the syntax coloring scheme determines which brackets are matched, it also determines what is inserted by the Insert Matching Bracket command. When an unclosed opening bracket is highlighted, the corresponding closing bracket is inserted. When an unmatched closing bracket is highlighted, the corresponding opening bracket is inserted. The HTML and XML schemes insert matching opening and closing tags.
The Insert Matching Bracket command is intended to be used while typing with minimal cursor movement. If you wanted to enter “this <b>bold</b> word” into an HTML file, you would first enter “this <b>bold”, then use Edit|Insert Matching Bracket, and then enter “ word”. When you use Edit|Insert Matching Bracket, the cursor is automatically placed after the inserted tag.
Do not use Insert Matching Bracket immediately after typing “this <b>“. Though it may seem neat to close the bold tag immediately, before typing its contents, this requires unnecessary cursor movement. You’d end up with the cursor after “this <b></b>“ requiring you to move the cursor back over the “</b>“ tag, then type “bold”, then move the cursor forward over “</b>“ and then type “ word”. Since EditPad Pro automatically highlights the “<b>“ tag as long as it is unclosed, there is no need to close it immediately. Simply leave it unclosed until you have typed in everything you want between the tag, and then use Edit|Insert Matching Bracket.
If you use Insert Matching Bracket when an unmatched closing bracket is highlighted, it inserts the matching opening bracket. The cursor is then placed to the left of the bracket that was inserted. This way you can easily use Edit|Insert Matching Bracket repeatedly to insert multiple opening brackets. E.g. if you type “unclosed)}]“ into a C++ file, then put the cursor before “unclosed”, and then use Edit|Insert Matching Bracket three times, you’ll get “[{(unclosed)}]“.
The Insert Matching Bracket command can match up an unmatched bracket even when matching brackets are highlighted. In the C statement if (a == b) && (c == d)) the last ) is unmatched. If you put the cursor before the first (, EditPad Pro will highlight it as being matched with the ) after b. This clearly shows that the if statement isn’t properly enclosed in parentheses. If you use Edit|Insert Matching Bracket with the cursor at this position, EditPad Pro looks for the nearest unmatched bracket. In this case that is the final ) in the statement. EditPad Pro inserts (, correctly completing if ((a == b) && (c == d)).
If you have turned on Options|Auto Break then automatic breaking and indentation is immediately applied to the inserted bracket. In this case, if you have an unclosed { in your C code, for example, place the cursor at the end of the last statement in the block. Then use Edit|Insert Matching Bracket to insert a line break, outdent the line, and insert the closing brace all at once.
If you do want to insert matching brackets immediately after entering an opening bracket, you can turn on Edit|Auto Match Brackets. Then when you type “this <b>“ EditPad immediately inserts “</b>“ after the cursor. Unlike Insert Matching Bracket, Auto Match Brackets does not move the cursor. So you can continue typing “bold” to get “this <b>bold</b>”. But to complete the phrase you will need to move the cursor over the “</b>“ before typing “ word”.
Edit menu
Edit|Auto Match Brackets
Go|Go to Matching Bracket
Go to Unmatched Bracket
Block|Between Matching Brackets
Options|Auto Break
File Types|Colors and Syntax
File Types|Brackets