Difference between revisions of "Editor Macros PascalScript"

From Free Pascal wiki
Jump to navigationJump to search
Line 14: Line 14:
  
 
= Objects provided =
 
= Objects provided =
 +
 +
Scripts an refer to the invoking SynEdit via the identifier "Caller".
 +
 +
The following methods and properties are available:
 +
 +
    property CaretX: Integer;
 +
    property CaretY: Integer;
 +
    property CaretXY: TPoint;
 +
    property LogicalCaretXY: TPoint;
 +
    property LogicalCaretX: TPoint;
 +
 +
    property BlockBegin: TPoint;
 +
    property BlockEnd: TPoint;
 +
    property SelAvail: Boolean; // read only
 +
    property SelText: string;
 +
    property SelectionMode: TSynSelectionMode;
 +
 +
    property Lines[Index: Integer]: string; // read only
 +
    property LineAtCaret: string;  // read only
 +
 +
    function SearchReplace(const ASearch, AReplace: string; AOptions: TSynSearchOptions): integer;
 +
    function SearchReplaceEx(const ASearch, AReplace: string; AOptions: TSynSearchOptions; AStart: TPoint): integer;

Revision as of 14:30, 27 August 2012

General

This feature is available in Lazarus 1.1. To use the feature the package EditorMacroScript must be installed.

This includes the PascalScript package. PascalScript is provided by REM Objects. A minimum package is provided with the Lazarus 1.1 distribution.

Simple actions

All simple Keyboard actions are represented as follows.

ecLeft;
Move Caret one to the left (in the editor that invoked the macro)
ecChar('a');
Inserts an 'a'

See the unit SynEditKeyCmds in pacckage SynEdit, and IDECommands in IDEIntf for a full list. Or use the Recorder to get the names of actions.

Objects provided

Scripts an refer to the invoking SynEdit via the identifier "Caller".

The following methods and properties are available:

   property CaretX: Integer;
   property CaretY: Integer;
   property CaretXY: TPoint;
   property LogicalCaretXY: TPoint;
   property LogicalCaretX: TPoint;
   property BlockBegin: TPoint;
   property BlockEnd: TPoint;
   property SelAvail: Boolean; // read only
   property SelText: string;
   property SelectionMode: TSynSelectionMode;
   property Lines[Index: Integer]: string; // read only
   property LineAtCaret: string;  // read only
   function SearchReplace(const ASearch, AReplace: string; AOptions: TSynSearchOptions): integer;
   function SearchReplaceEx(const ASearch, AReplace: string; AOptions: TSynSearchOptions; AStart: TPoint): integer;