Skip to content

Commit 8576581

Browse files
authored
docs: added usage tip for registerMarker()
1 parent 2042bb8 commit 8576581

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

typings/xterm.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,18 @@ declare module '@xterm/xterm' {
11591159
deregisterCharacterJoiner(joinerId: number): void;
11601160

11611161
/**
1162-
* Adds a marker to the normal buffer and returns it.
1162+
* Adds a marker to the normal buffer and returns it.
1163+
* NOTE: If you are synchronously writing data line-by-line (as in, doing
1164+
* multiple `term.writeln()`before the terminal re-rendering), the cursorY
1165+
* position will not be updated until after all pending terminal writes,
1166+
* which will result in the markers offset being calculated from the
1167+
* position cursorY was when your batch of writes started.
1168+
* Dealing with this issue by setting `cursorYOffset` to be index of this
1169+
* line in your batch will fail if you have any line wraps prior to it.
1170+
* Instead, consider registering a marker inside a write callback, eg.:
1171+
* ```ts
1172+
* term.writeln(data, () => term.registerMarker(...))
1173+
* ```
11631174
* @param cursorYOffset The y position offset of the marker from the cursor.
11641175
* @returns The new marker or undefined.
11651176
*/

0 commit comments

Comments
 (0)