Forum > Editor

Region fold all not working?

(1/3) > >>

chrnobel:
Using Lazarus 2.2.0 I cannot get {region /fold} to work, when I try to fold all, using Alt-Shift 1.

All procedures etc. are folded as expected, but the region remains unfolded - however I am able to fold one region by right clicking on the -  next to {region /fold}.

The Alt-shift 1 key is bound to fold all.

And if I manually fold one region by mouse clicking, and then press the Alt-shift 1, the region (but not the procedures) actually opens again!

dsiders:

--- Quote from: chrnobel on May 13, 2022, 07:20:41 pm ---Using Lazarus 2.2.0 I cannot get {region /fold} to work, when I try to fold all, using Alt-Shift 1.

All procedures etc. are folded as expected, but the region remains unfolded - however I am able to fold one region by right clicking on the -  next to {region /fold}.

The Alt-shift 1 key is bound to fold all.

And if I manually fold one region by mouse clicking, and then press the Alt-shift 1, the region (but not the procedures) actually opens again!

--- End quote ---

There is no "Fold all" key mapping. The default mapping for Alt+Shift+1 is "Fold to Level 1". Did you change it? Is your region directive at that level?

It works for me when the region is at the correct level. If does not fold if it is at the same level as the unit, interface, implementation, or end keywords.  You can use Alt+Shift+- and Alt+Shift+= for these regions though.

HTH

chrnobel:

--- Quote from: dsiders on May 13, 2022, 09:11:17 pm ---Did you change it?
--- End quote ---
It is a fresh installation of Lazarus, so no.


--- Quote ---Is your region directive at that level?
--- End quote ---
I have no idea, where can I check which level a regions directive has?

dsiders:

--- Quote from: chrnobel on May 13, 2022, 09:33:49 pm ---
--- Quote from: dsiders on May 13, 2022, 09:11:17 pm ---Did you change it?
--- End quote ---
It is a fresh installation of Lazarus, so no.


--- Quote ---Is your region directive at that level?
--- End quote ---
I have no idea, where can I check which level a regions directive has?

--- End quote ---


I do not know... other than my observations.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit testimagemain; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls; type  {$region 'Prior to level 1... Alt+Shift+1 does not fold. But Alt+Shift+- does.'}  { TForm1 }  TForm1 = class(TForm)    Image1: TImage;    Image2: TImage;    Label1: TLabel;    Label2: TLabel;    {$region 'TForm1 is at level 1... Alt+Shift+1 folds.'}    procedure FormCreate(Sender: TObject);    {$endregion}  private   public   end;  {$endregion} ...  

Martin_fr:
regions don't have (that kind of) level.

The keyboard folding "fold to level n" (usually Alt-Shift-<num>) only works on Pascal-code.

For Pascal code levels depend on the config and code.
If you did set "unit" to be foldable, then that is likely the most outer level. "implementation (if configured) is then the 2nd level.

If you don't have those fold-able then "procedure" may be your first level, and then each nested begin inside opens a new level.

The fold gutter itself has a context menu that will (if applicable) offer "hide [all] comments [in selection]" and/or "fold inactive IFDEF"

But no such helper for regions exists. => they can only be folded individually. One by one.
 
You can inspect the code in unit SynGutterCodeFolding.

There you could add such an entry to the context menu. But it will require some study of the existing code.

Navigation

[0] Message Index

[#] Next page

Go to full version