text improvements

This commit is contained in:
Simon Lamon
2022-02-12 09:42:08 +00:00
parent d64cbc41d5
commit 4ca26f7e7b
2 changed files with 8 additions and 8 deletions
@@ -419,7 +419,7 @@ export class SerializeAddon implements ITerminalAddon {
private _serializeBufferAsHTML(terminal: Terminal, options: Partial<IHTMLSerializeOptions>): string {
const buffer = terminal.buffer.active;
const handler = new HTMLSerializeHandler(buffer, terminal, options);
const onlySelection = options.onlySelection ?? true;
const onlySelection = options.onlySelection ?? false;
if (!onlySelection) {
const maxRows = buffer.length;
const scrollback = options.scrollback;
@@ -556,7 +556,7 @@ export class HTMLSerializeHandler extends BaseSerializeHandler {
let foreground = '#000000';
let background = '#ffffff';
if (this._options.includeGlobalBackground ?? true) {
if (this._options.includeGlobalBackground ?? false) {
foreground = this._terminal.options.theme?.foreground ?? '#ffffff';
background = this._terminal.options.theme?.background ?? '#000000';
}
@@ -33,9 +33,9 @@ declare module 'xterm-addon-serialize' {
public serialize(options?: ISerializeOptions): string;
/**
* Serializes terminal rows into a HTML string. The output of this function can be written
* to the OS clipboard. If an application supports pasting HTML, the content of the terminal
* is pasted with style options retained.
* Serializes terminal content as HTML, which can be written to the clipboard using the
* `text/html` mimetype. For applications that support it, the pasted text should then retain
* its colors/styles.
*
* @param options Custom options to allow control over what gets serialized.
*/
@@ -70,18 +70,18 @@ declare module 'xterm-addon-serialize' {
/**
* 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 setting is ignored if {@link IHTMLSerializeOptions.onlySelection} is true.
*/
scrollback: number;
/**
* Whether to only serialize the selection. If false, the whole active buffer is serialized in HTML.
* True by default.
* False by default.
*/
onlySelection: boolean;
/**
* Whether to include the global background of the terminal. True by default.
* Whether to include the global background of the terminal. False by default.
*/
includeGlobalBackground: boolean;
}