EditorSelect
The EditorSelect is used in the
EditorControl function
to select or deselect text in the FAR editor.
struct EditorSelect { int BlockType; int BlockStartLine; int BlockStartPos; int BlockWidth; int BlockHeight; };
Elements
BlockType
One of the following values (the EDITOR_BLOCK_TYPES enumeration):
If BlockType is equal to BTYPE_NONE, other fields of the structure are ignored.
Block type | Description |
---|---|
BTYPE_NONE | deselect block |
BTYPE_STREAM | select stream block |
BTYPE_COLUMN | select column (rectangular) block |
BlockStartLine
First line of the selection. The field can be
-1
- current line will be the start of the block.BlockStartPos
Start position of the selection.
If BlockStartPos = -1, text is deselected.
BlockWidth
Block width. Can be negative.
BlockHeight
Block height, should be >= 1
Remarks
- EditorControl function returns FALSE, if:
- size of transferred variable is less than EditorSelect structure;
- BlockHeight is less than 1;
- BlockStartLine is greater than number of lines in editor.
Example
Stream block from (X1,Y1) to (X2,Y2) can be selected in this way:
es.BlockType=BTYPE_STREAM; es.BlockStartLine=min(Y2,Y1); es.BlockStartPos=(Y1 < Y2?X1:X2); // small correction if positions are equal if(X1 == X2) es.BlockStartPos+=(Y1 < Y2?1:-1); es.BlockHeight=max(Y1,Y2)-min(Y1,Y2)+1; if(Y1 < Y2) es.BlockWidth=X2-X1+1; else es.BlockWidth=X1-X2+1; if(X1 == X2) { if(Y1 < Y2) es.BlockStartPos--; else es.BlockStartPos++; } Info.EditorControl(ECTL_SELECT,(void*)&es);
See also: