Add range API to serialize addon

Fixes #4876
Fixes #4871
This commit is contained in:
Daniel Imms
2023-11-09 09:43:14 -08:00
parent 49eab6b1d9
commit b595940bcf
3 changed files with 102 additions and 58 deletions
+19 -2
View File
@@ -3,7 +3,7 @@
* @license MIT
*/
import { Terminal, ITerminalAddon } from '@xterm/xterm';
import { Terminal, ITerminalAddon, IMarker, IBufferRange } from '@xterm/xterm';
declare module '@xterm/addon-serialize' {
/**
@@ -48,10 +48,16 @@ declare module '@xterm/addon-serialize' {
}
export interface ISerializeOptions {
/**
* The row range to serialize. The an explicit range is specified, the cursor will get its final
* repositioning.
*/
range?: ISerializeRange;
/**
* The number of rows in the scrollback buffer to serialize, starting from the bottom of the
* scrollback buffer. When not specified, all available rows in the scrollback buffer will be
* serialized.
* serialized. This will be ignored if {@link range} is specified.
*/
scrollback?: number;
@@ -85,4 +91,15 @@ declare module '@xterm/addon-serialize' {
*/
includeGlobalBackground: boolean;
}
export interface ISerializeRange {
/**
* The line to start serializing (inclusive).
*/
start: IMarker | number;
/**
* The line to end serializing (inclusive).
*/
end: IMarker | number;
}
}