views:

65

answers:

0

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?

Thanks