View Issue Details

IDProjectCategoryView StatusLast Update
0023884LazarusIDEpublic2018-07-12 12:50
ReporterSven Barth Assigned ToMartin Friebe  
Status assignedResolutionopen 
Product Version1.1 (SVN) 
Summary0023884: Feature request: Improved editor handling for bracket pairs ( (), [], {} ) and ' '
DescriptionFor a university project of mine I'm currently using code::blocks to write a C library. While I could curse each time about missing handling of something like "Ctrl+Shift+Up/Down" I found one feature which might be nice for Lazarus as well (optinally of course):

When one writes a opening bracket (e.g. (, [ or { ) or a quote char (in C's case " in Pascal it would be ' ) a corresponding closing element is added immediately after it (e.g. a ), ], } or " depending on the opening element), but the cursor stays after the opening element (so that one can write the content for the brackets). If one has now finished writing the content user might automatically insert the closing element (like in my case, because I'm used to do this from Delphi/Lazarus), but instead of now having e.g. two ) the editor recognizes that the closing element already exists and does not write another one. If a ; was automatically added because of a function completion (like our CodeTools) the ; will also be ignored if one writes a ;.

A little example is given in Additional Information.
Additional Information"|" denotes the cursor position.

Assume for now that "IntToStr" was written without Code Completion (thus the "add brackets" option won't help here)

  s := IntToStr|

"(" is pressed and the ")" will be inserted (the ";" won't be inserted here, though it would be a nice to have if CodeTools could detect that a ";" would be useful here)

  s := IntToStr(|)

Writing the content

  s := IntToStr(value|)

Now ");" is written

a) current result

  s := IntToStr(value);|)

b) wanted result
  s := IntToStr(value);|

Similar for strings with ''.

The example again this time with autocompletion of "IntToStr":

  s := IntToSt|


  s := IntToStr(|);

Writing the content

  s := IntToStr(value|);

Writing ");"

a) current result

  s := IntToStr(value);|);

b) wanted result

  s := IntToStr(value);|
TagsNo tags attached.
Fixed in Revision
Attached Files


has duplicate 0025723 closedMartin Friebe Add option to auto close single quotes and parenthesis 
related to 0023318 new auto completion for parenthesis in if 


Martin Friebe

2018-01-11 14:56

manager   ~0105663

You may be able to do this with editor macros.

Assign them to the key for your opening bracket (it will be assigned to the key combo e.g. shift-9 / so it will not follow locale)

unconditional bracket

But you can add pascal script to check if the bracket exists.
And you can also check if ) exists, and skip it.
This still remains a valid feature request.

Issue History

Date Modified Username Field Change
2013-02-14 20:45 Sven Barth New Issue
2013-02-14 22:17 Martin Friebe Assigned To => Martin Friebe
2013-02-14 22:17 Martin Friebe Status new => assigned
2013-09-14 19:35 Martin Friebe LazTarget - => post 1.4
2014-02-16 14:41 Martin Friebe Relationship added has duplicate 0025723
2015-04-25 14:33 Martin Friebe LazTarget post 1.4 => -
2018-01-11 14:56 Martin Friebe Note Added: 0105663
2018-07-12 12:50 Martin Friebe Relationship added related to 0023318