Question

I wanna insert a region in an edit view and then fold this region.

// fEditView: IOTAEditView;

var
  writer: IOTAEditWriter;
begin
  writer := fEditView.Buffer.CreateUndoableWriter;
  //...
  writer.Insert('{$REGION ''Documentation''}'#13#10'{$ENDREGION}');
  writer := nil;  // Flush the buffer
  fEditView.Position.GotoLine(lineNo); // go to the line number of the region
  fEditView.Paint;
end;

This code snippet will insert a region in the code editor. But the IDE needs some action to generate such a region in the code editor.

Is there any way to force the IDE do this action and then I can use

(fEditView as IOTAElideActions).ElideNearestBlock;

to fold it?

Was it helpful?

Solution

Found by grubby trial-and-error :-)

(fEditView as IOTAElideActions).EnableElisions;
(fEditView as IOTAElideActions).EnableElisions;
(fEditView as IOTAElideActions).ElideNearestBlock;

EnableElisions() appears to actually toggle the elisions feature.

Turning elisions off and back on again seems to have the desired effect. There is some not very pretty screen updating going on. Whether it is possible to suppress that I don't know.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top