Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-11

Code Folding marker in the editor itself

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I haven't used code folding much, only as a method divider option (Options | Editor | Code Folding). But one thing I noticed while playing with code folding is that it doesn't give much visual feedback that a section of code has been folder.

procedure Test1;
begin
  bla..bla..bla..
end;
procedure Test2;
begin
  bla..bla..bla..
end;

folded as:

  procedure Test1;
[+] begin
procedure Test2;
begin
  bla..bla..bla..
end;

This just looks weird, seeing an 'begin' with nothing else. Maybe when begin..end blocks are folded, it should paint a hint in the editor as well, not just the [+] in the gutter.

eg:

  procedure Test1;
[+] begin  [...]
procedure Test2;
begin
  bla..bla..bla..
end;

The [+] is in the gutter as normal and the [...] is painted after the 'begin' to clearly indicate that other code exists, it's just folded. See the attached image for how Delphi does it. I think that is quite nice.

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: codefolding_hint.png
Type: image/png
Size: 4864 bytes
Desc: not available
Url : http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20081126/f2a47f90/attachment.png

Reply by email

Brad Campbell
to Graeme Geldenhuys
Graeme Geldenhuys wrote
The [+] is in the gutter as normal and the [...] is painted after the 'begin' to clearly indicate that other code exists, it's just folded. See the attached image for how Delphi does it. I think that is quite nice.

The best feature I've seen on a similar theme thus far is the little [...] after the text and if you hover over the folded line the contents of the folded block pop up in a hint. Very, very nice feature that.

Martin has been working very hard on the folding for a while now and has cleaned up the code into much more manageable chunks. I suspect when he's done with the re-factoring and cleanup features like this will be far easier to implement as addons to the existing Synedit component.

Brad

Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish.

Reply by email

Graeme Geldenhuys
to Brad Campbell
Brad Campbell wrote 6 lines
The best feature I've seen on a similar theme thus far is the little [...] after the text and if you hover over the folded line the contents of the folded block pop up in a hint. Very, very nice feature that.

I've seen that before in other editor, but I don't really see the point. If you want to see the code simply click the [+]. It's no extra effort... You already have to move the mouse over the [...], so you can just as well move it over the [+] and click. That way you get the correct syntax highlighting and if you want to edit or scroll the code, it is already visible.

Nevertheless, the [...] would be very handy. I have been trying to implement it for the last hour. The synedit code is just way to complicated for me to understand and figure out in a short time. :-( I have screwed up my Lazarus editor a few times in my attempts. Luckily I made a backup of my executable before I started hacking away. :-)

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email