mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
docs: added usage tip for registerMarker()
This commit is contained in:
Vendored
+12
-1
@@ -1159,7 +1159,18 @@ declare module '@xterm/xterm' {
|
||||
deregisterCharacterJoiner(joinerId: number): void;
|
||||
|
||||
/**
|
||||
* Adds a marker to the normal buffer and returns it.
|
||||
* Adds a marker to the normal buffer and returns it.
|
||||
* NOTE: If you are synchronously writing data line-by-line (as in, doing
|
||||
* multiple `term.writeln()`before the terminal re-rendering), the cursorY
|
||||
* position will not be updated until after all pending terminal writes,
|
||||
* which will result in the markers offset being calculated from the
|
||||
* position cursorY was when your batch of writes started.
|
||||
* Dealing with this issue by setting `cursorYOffset` to be index of this
|
||||
* line in your batch will fail if you have any line wraps prior to it.
|
||||
* Instead, consider registering a marker inside a write callback, eg.:
|
||||
* ```ts
|
||||
* term.writeln(data, () => term.registerMarker(...))
|
||||
* ```
|
||||
* @param cursorYOffset The y position offset of the marker from the cursor.
|
||||
* @returns The new marker or undefined.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user