[Lazarus] Can the Lazarus IDE match parentheses and begin/ends?

Bo Berglund bo.berglund at gmail.com
Sat Jan 6 10:25:36 CET 2018


On Fri, 5 Jan 2018 14:12:59 +0100, Martin Frb via Lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>On 05/01/18 12:41, Bo Berglund via Lazarus wrote:
>> I wonder if it is possible (and if so how) to enable the Lazarus code
>> editor to match the open/close parenthesis and begin/end block
>> delimiters?

Martin, thanks for your detailed description! It made it possible for
me to at least partially solve the problem!
>
>brackets are already answered in the other mails.

But the links in these replies go to a webpage that says a bit down:

"Bracket Highlight

If the cursor is behind or in front of a bracket, highlight matching
bracket"

And that is all. No description on *how* to actually activate this
function, which was clearly not working in my Lazarus...
Also the definition of a "bracket" is a bit muddy. Does it refer to
square parenthesis [ ] or normal ( ) or begin end or all of these?

Furthermore the webpage directs me to the "Automatic feature" page of
the editor option, which in fact does not exist in my Lazarus.
Under Editor there are 8 subpages, none named "Automatic feature". If
one expands the Display node there are Colors, Markup and Matches,
User defined markup. So the wiki page is misleading.

>begin/end is not on the wiki (yet), but it is in the Options dialog 
>under > Editor > Display > Markup and Matches
>
>It is called "Word Brackets on caret"
>
>There is a listbox with: "Procedure","Begin/end", "repeat" .....
>you can select each entry and check "Markup (on caret), to get the highlight

In my case these are all checked except for the last 4 boxes.
Additionally the checkbox to the right "Markup (on  caret)" is checked
as is the top "Word Brackets on caret" and yet I did not see anything
in the IDE...
Do I have to use some kind of hot key to make it display?

Well, it seems to be a mis-match in the default settings where the
feature is enabled by default but the colors are set by default to
completely hide the highlight....
Seems like a strange way to set the defaults.

>eg
>*  "Procedure" will highlight 3 keyword: Procedure, begin, end,
>* "Begin/end (procedure)" highlights only the begin and end of a 
>procedure block
>
>You can choose the kind of highlight (eg change back color, instead of 
>frame) in the "Colors" page of the option dialog.

After a lot of fiddling I managed to get the following working:

begin-end:  A red box pink background via "Word-brackets" color
[ ]: basically the same, but via "Brackets highlights" color
if-then-else: same via "Word-brackets" color

Not working:
( ): Controlled by what?
And this is what I originally was looking for because I frequently
make ( ) errors....


-- 
Bo Berglund
Developer in Sweden



More information about the Lazarus mailing list