EditorInfo

Far Manager

EditorInfo

The EditorInfo structure is used in the EditorControl function to get information about the current FAR editor state.
struct EditorInfo
{
  int EditorID;
  const char *FileName;
  int WindowSizeX;
  int WindowSizeY;
  int TotalLines;
  int CurLine;
  int CurPos;
  int CurTabPos;
  int TopScreenLine;
  int LeftPos;
  int Overtype;
  int BlockType;
  int BlockStartLine;
  int AnsiMode;
  int TableNum;
  DWORD Options;
  int TabSize;
  int BookMarkCount;
  DWORD CurState;
  DWORD Reserved[6];
};

Elements

EditorID
Identifier of the editor instance. Each editor instance has a unique identifier during the lifetime of a FAR session.
FileName
Full path and name of the edited file .
WindowSizeX, WindowSizeY
Width and height of the editor window.
TotalLines
Total number of lines in the edited text.
CurLine
Number of the current line.
CurPos
Cursor position in the current line.
CurTabPos
Cursor screen position in the current line. If the line does not contain tab characters, CurTabPos is equal to CurPos.
TopScreenLine
Number of the line at the top of the screen.
LeftPos
Position of the left border of the editor window in the edited text.
Overtype
Overtype mode state. 0 - insert mode, 1 - overtype mode.
BlockType
Type of the selected block. One of the following values (the EDITOR_BLOCK_TYPES enum):
Block typeDescription
BTYPE_NONE no selection,
BTYPE_STREAM stream block
BTYPE_COLUMN column (rectangular) block.
BlockStartLine
Number of the first line in the selected block.
AnsiMode
ANSI text mode state. This field is nonzero only when no character table is used and the text is in the ANSI codepage.
TableNum
Number of FAR character table currently used in the editor. -1 if no table is used and the text is in OEM format (in this case see AnsiMode). If this field is not -1, you can pass it to the CharTable function to get the table.
Options
Describes the state of editor options. Can be a combination of the following flags (the EDITOR_OPTIONS enumeration):
FlagDescription
EOPT_EXPANDTABS The "Expand all tabs to spaces" option is selected. While editing a file convert all entered and existing Tab characters to the corresponding number of spaces.
This parameter can be changed using the ECTL_SETPARAM command (ESPT_EXPANDTABS).
EOPT_EXPANDONLYNEWTABS The "Expand newly entered tabs to spaces" option is selected. While editing a file convert all newly entered Tab characters to the corresponding number of spaces. Existing Tab characters won't be converted.
This parameter can be changed using the ECTL_SETPARAM (ESPT_EXPANDTABS).
EOPT_PERSISTENTBLOCKS "Persistent blocks" option is on.
EOPT_DELREMOVESBLOCKS "Del removes blocks" option is on.
EOPT_AUTOINDENT "Auto indent" option is on. This parameter can be changed using the ECTL_SETPARAM command.
EOPT_AUTODETECTTABLE "Autodetect character table" option is on.
EOPT_CURSORBEYONDEOL "Cursor beyond end of line" option is on. This parameter can be changed using the ECTL_SETPARAM command.
EOPT_SAVEFILEPOSITION "Save file position" option is on. This parameter can be changed using the ECTL_SETPARAM command.
TabSize
Tab size. This parameter can be changed using the ECTL_SETPARAM command.
BookMarkCount
Number of editor bookmarks. To retrieve information about bookmarks, use the ECTL_GETBOOKMARKS command.
CurState
Current state of the text in the editor. Can contain one or more of the following flags (the EDITOR_CURRENTSTATE enumeration):
FlagDescription
ECSTATE_MODIFIED modified
ECSTATE_SAVED saved
ECSTATE_LOCKED locked (Ctrl-L)
Reserved
Reserved for future use.

Remarks

To determine current character set in the editor exactly, the following table can be used:
                    EditorInfo.TableNum        EditorInfo.AnsiMode
DOS                          -1                         0
WIN                          -1                         1
Other                   Table number                    0
For "Other", the CharTable function should be used to retrieve the character table name.
See also: