doLinemarker

doLinemarker(action: Integer;
             param1: Integer;
             param2: Integer): Integer;

The doLinemarker method of the JadeTextEdit class performs linemark-related actions.

The values of the action, param1, and param2 parameters and the return values are listed in the following table. (The action parameter values are represented by JadeTextEdit class constants.)

action param1 param2 Returns… Description
LMACT_ADD (1) Line # Marker # Handle # Adds the linemark number specified in param2 to the line specified in param1. If param1 is zero (0), the currentLine property value is used. It returns the handle of the new linemark if successful, else -1 if the add action failed.
LMACT_DELETE (2) Line # Marker # N/A Removes the linemark number specified in param2 from the line specified in param1 (if present). If param1 is zero (0), the currentLine property value is used. Removes all markers on the specified line deleted if -1 specified in param2.
LMACT_DELETEALL (3) Line # N/A N/A Removes the linemark number specified in param1 (if present) from all lines. If param1 is -1, all linemarks are deleted from all lines.
LMACT_DELETEBYHANDLE (4) Handle # N/A N/A Removes the linemark associated with the specified linemark handle, if it exists.
LMACT_GETBITMASK (5) Line # N/A Bit mask Returns a bit mask that represents the linemarks currently set on the line specified in param1.
LMACT_GETLINEFROMHANDLE (6) Handle # N/A Line # Returns the line number of the line that has the linemark associated with the linemark handle specified in param1. Returns zero (0) if handle is not found.
LMACT_GONEXTBYNUMBER (7) Line # Marker # New line # Moves the caret to the start of the next line following the one specified in param1 that has a linemark with the number specified in param2. If param1 is zero (0), the search starts after the value of the currentLine property. It returns the new line number if found, else zero (0).
LMACT_GOPRIORBYNUMBER (8) Line # Marker # New line # Moves the caret to the start of the first line preceding the one specified in param1 that has a linemark with the number specified in param2. If param1 is zero (0), then the search starts before the value of the currentLine property. If param1 is greater than the value of the lineCount property, the search starts from the last line. It returns the new line number if found, else zero (0).
LMACT_GONEXTINBITMASK (9) Line # Bit mask New line # Moves the caret to the start of the next line following the one specified in param1 that has a linemark with its number matching any bit in the bit mask specified in param2. If param1 is zero (0), the search starts after the value of the currentLine property. It returns the new line number if found, else zero (0).
LMACT_GOPRIORINBITMASK (10) Line # Bit mask New line # Moves the caret to the start of the first line preceding the one specified in param1 that has a linemark with its number matching any bit in the bit mask specified in param2. If param1 is zero (0), the search starts before the value of the currentLine property. If param1 is greater than the value of the lineCount property, the search starts from the last line. It returns the new line number if found, else zero (0).
LMACT_GOHANDLE (11) Handle # N/A New line # Moves the caret to the start of the line that has the linemark associated with the handle specified in param1. It returns the new line number if found, else zero (0).
LMACT_MOVESINGLETOLINE (12) Line # Marker # Handle # Deletes all occurrences of the linemark number specified in param2 then adds a linemark with the number specified in param2 to the line specified in param1, making the line visible. It returns the handle of the new linemark if successful, else -1.
LMACT_MOVESINGLETOPOSITION (13) Offset # Marker # Handle # Deletes all occurrences of the linemark number specified in param2 then adds a linemark with the number specified in param2 to the line that contains the character at the offset specified in param1, making that line visible. It returns the handle of the new linemark if successful, else -1.
LMACT_ADDATPOSITION (14) Offset # Marker # Handle # Adds linemark number specified in param2 to the line that contains the character at offset specified in param1. It returns the handle of the new linemark if successful, else -1.

In this table, the first three columns represent the method parameters (that is, action, param1, and param2, respectively). The add, delete, and get actions do not move the caret position.

The values in the second, third, and fourth columns of the preceding table (that is, values in the middle three columns) are described in the following table.

Value Description
Line # Line number in the range 1 through the number of the last line in the text editor. A line number value of zero (0) indicates the current line.
Marker # Marker number in the range zero (0) through 31. However, as folding uses marker numbers in the range 25 through 31, you should not use these values.
Bit mask Integer representing marker numbers.
Handle # Unique integer value assigned when each marker is added.
New line # Line number to which the caret is moved, and zero (0) if there is no match.

The code fragment in the following example shows the use of the doLinemarker method. It deletes all linemarks with number 1, adds a linemark number 1 to the current line, and saves its handle. It adds a linemark number 2 to every line that contains the text "theWord", moving the caret (and view) to the first linemark number 2 following the current line. It moves the caret (and view) back to the starting line.

handl:=jteSource.doLinemarker(JadeTextEdit.LMACT_MOVESINGLETOPOSITION,0,1);
jteSource.findMarkAll( "theWord", 0, 1, false, false, 0, 2, true);
jteSource.doLinemarker(JadeTextEdit.LMACT_GONEXTBYNUMBER, 0, 2);
jteSource.doLinemarker(JadeTextEdit.LMACT_GOHANDLE, handle, 0);