Comments in Source Editor lazarus / 9-Editor ---------------------------------------------------------------------- Blaazen · 2009-11-11 10:49 Hi, as I write my code it becomes longer and I use that feature which enables 'close' long procedure or function to a single line (I think it's called "code folding" in terms of TSynEdit). O.K. but... I have many folded procedures and when I want add comment for example somewhere in the half of my source code and I use { curly bracket then all procedures from that point to the end of file are automatically unfolded (and of course become blue  ).  When I write } right bracket then they don't fold again  . Is there any solution? And second question: Is there any component like TListBox, which enables writing multicolor? I need only two or three different colors with the same font and I think TSynEdit is too robust for this. Thanks B. ---------------------------------------------------------------------- Bart · 2009-11-11 11:34 I find it annoying too that after entering { all text that follows gets a "comment" colour (true in Delphi also), so for a long time  now , whenever I want to write a comment in {} I enter the last one first. The IDE cannot guess where you want to put the ending }, so it must behave as it does. Bart ---------------------------------------------------------------------- Blaazen · 2009-11-11 11:43 Yes, it's also my idea write first } and then {. But sometimes (usually late night) I forget and it's hell because I have unit with almost 7000 lines and 290 procedures/functions. Thanks anyway. B. ---------------------------------------------------------------------- Martin_fr · 2009-11-11 12:10 I thought about this too. But it's not trivial to solve. The easiest would probably be, if the editor has an option that allows "closing" chars to be added automatically. Similiar like code completion. If you type a {, then a } will be inserted too, and the cursor be in the middle. Similiar could be done for [] () '' "" The other option is to defer updating all lines below the current line. Either just about 1 or 2 sec, so that you can write the closing bracked yourself (but have to do so immediately); or to delay, until you break typing for a second or two. Both of that are a lot of work. My favourite, but also too much work for now, would be a variation of the first solution. The opposite bracket is created, but as something like an insert-proposal. It could be displayed in a hint like manner, and hangs on the caret. That would allow you to type or move the caret (even with the cursor keys) and insert the closing brakcet where you like. As long as the proposal exists the editor has do redefine 2 keys: escape discard proposal enter or ctrl enter or the like to insert proposal Someday in the future. --- btw another way to insert comments is to type   // { coment then to write, and insert your } some lines below. After that remove the "//" There also is a function to quickly fold all folds. You can assign this to your keyboard. via the option "key mapping" "Text folding commands" "fold to level n" (level => the amount of outer nestings) ---------------------------------------------------------------------- Blaazen · 2009-11-11 12:36 Thanks, I think it is solved, auto-fold everything is enough for me, because I usually work only with one or two proc./func. and everything else is folded. ShortCut is default Alt+Shift+(1..9) for folding and Alt+Shift+0 for unfolding. And write first } and then {. And my second question, is there anything like TListBox with different colors for each line? B. ---------------------------------------------------------------------- theo · 2009-11-11 13:06 You can use the OnDrawItem event of TListBox with Style set to lbOwnerDrawFixed for example. Then you can paint yourself like: Code: [Select]TListBox(Control).Canvas.FillRect(ARect); TListBox(Control).Canvas.Font.Color:=clred; TListBox(Control).Canvas.TextRect(ARect,...etc ---------------------------------------------------------------------- Blaazen · 2009-11-12 15:36 Thanks, I have multicolor ListBox now  . B.