Feature request: Improved editor handling for bracket pairs ( (), [], {} ) and ' '
Original Reporter info from Mantis: PascalDragon @PascalDragon
-
Reporter name: Sven Barth
Original Reporter info from Mantis: PascalDragon @PascalDragon
- Reporter name: Sven Barth
Description:
For 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|
"Ctrl+Space"
s := IntToStr(|);
Writing the content
s := IntToStr(value|);
Writing ");"
a) current result
s := IntToStr(value);|);
b) wanted result
s := IntToStr(value);|
Mantis conversion info:
- Mantis ID: 23884
- OS: Linux
- OS Build: 3.6
- Platform: i386
- Version: 1.1 (SVN)
- Monitored by: » luizamerico (Luiz Americo)