Merge branch 'master' into full
This commit is contained in:
+1
-5
@@ -548,11 +548,7 @@ function addDecoration() {
|
|||||||
term.options['overviewRulerWidth'] = 15;
|
term.options['overviewRulerWidth'] = 15;
|
||||||
const marker = term.addMarker(1);
|
const marker = term.addMarker(1);
|
||||||
const decoration = term.registerDecoration({ marker, overviewRulerOptions: { color: '#ef2929'} });
|
const decoration = term.registerDecoration({ marker, overviewRulerOptions: { color: '#ef2929'} });
|
||||||
decoration.onRender((e) => {
|
decoration.onRender((e) => e.style.backgroundColor = '#ef2929');
|
||||||
if (e.classList.value === 'xterm-decoration') {
|
|
||||||
e.style.backgroundColor = '#ef2929';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function addOverviewRuler() {
|
function addOverviewRuler() {
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export class OverviewRulerRenderer extends Disposable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._ctx.lineWidth = 1;
|
this._ctx.lineWidth = 1;
|
||||||
this._ctx.fillStyle = decoration.options.overviewRulerOptions.color;
|
this._ctx.fillStyle = decoration.overviewRulerOptions?.color || decoration.options.overviewRulerOptions.color;
|
||||||
this._ctx.fillRect(
|
this._ctx.fillRect(
|
||||||
decoration.options.overviewRulerOptions.position === 'full' || decoration.options.overviewRulerOptions.position === 'left' ? 0 : decoration.options.overviewRulerOptions.position === 'right' ? renderSizes[SizeIndex.OUTER_SIZE] + renderSizes[SizeIndex.INNER_SIZE]: renderSizes[SizeIndex.OUTER_SIZE],
|
decoration.options.overviewRulerOptions.position === 'full' || decoration.options.overviewRulerOptions.position === 'left' ? 0 : decoration.options.overviewRulerOptions.position === 'right' ? renderSizes[SizeIndex.OUTER_SIZE] + renderSizes[SizeIndex.INNER_SIZE]: renderSizes[SizeIndex.OUTER_SIZE],
|
||||||
Math.round(this._canvas.height * (decoration.options.marker.line / this._bufferService.buffers.active.lines.length)),
|
Math.round(this._canvas.height * (decoration.options.marker.line / this._bufferService.buffers.active.lines.length)),
|
||||||
@@ -120,7 +120,6 @@ export class OverviewRulerRenderer extends Disposable {
|
|||||||
this._decorationElements.set(decoration, this._canvas);
|
this._decorationElements.set(decoration, this._canvas);
|
||||||
}
|
}
|
||||||
this._refreshStyle(decoration, updateAnchor);
|
this._refreshStyle(decoration, updateAnchor);
|
||||||
decoration.onRenderEmitter.fire(this._canvas);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {
|
private _queueRefresh(updateCanvasDimensions?: boolean, updateAnchor?: boolean): void {
|
||||||
|
|||||||
+11
-1
@@ -98,6 +98,12 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
|||||||
*/
|
*/
|
||||||
private _keyDownHandled: boolean = false;
|
private _keyDownHandled: boolean = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records whether a keydown event has occured since the last keyup event, i.e. whether a key
|
||||||
|
* is currently "pressed".
|
||||||
|
*/
|
||||||
|
private _keyDownSeen: boolean = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Records whether the keypress event has already been handled and triggered a data event, if so
|
* Records whether the keypress event has already been handled and triggered a data event, if so
|
||||||
* the input event should not trigger a data event but should still print to the textarea so
|
* the input event should not trigger a data event but should still print to the textarea so
|
||||||
@@ -1083,6 +1089,7 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
|||||||
*/
|
*/
|
||||||
protected _keyDown(event: KeyboardEvent): boolean | undefined {
|
protected _keyDown(event: KeyboardEvent): boolean | undefined {
|
||||||
this._keyDownHandled = false;
|
this._keyDownHandled = false;
|
||||||
|
this._keyDownSeen = true;
|
||||||
|
|
||||||
if (this._customKeyEventHandler && this._customKeyEventHandler(event) === false) {
|
if (this._customKeyEventHandler && this._customKeyEventHandler(event) === false) {
|
||||||
return false;
|
return false;
|
||||||
@@ -1168,6 +1175,8 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected _keyUp(ev: KeyboardEvent): void {
|
protected _keyUp(ev: KeyboardEvent): void {
|
||||||
|
this._keyDownSeen = false;
|
||||||
|
|
||||||
if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {
|
if (this._customKeyEventHandler && this._customKeyEventHandler(ev) === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1241,7 +1250,8 @@ export class Terminal extends CoreTerminal implements ITerminal {
|
|||||||
protected _inputEvent(ev: InputEvent): boolean {
|
protected _inputEvent(ev: InputEvent): boolean {
|
||||||
// Only support emoji IMEs when screen reader mode is disabled as the event must bubble up to
|
// Only support emoji IMEs when screen reader mode is disabled as the event must bubble up to
|
||||||
// support reading out character input which can doubling up input characters
|
// support reading out character input which can doubling up input characters
|
||||||
if (ev.data && ev.inputType === 'insertText' && !ev.composed && !this.optionsService.rawOptions.screenReaderMode) {
|
// Based on these event traces: https://github.com/xtermjs/xterm.js/issues/3679
|
||||||
|
if (ev.data && ev.inputType === 'insertText' && (!ev.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {
|
||||||
if (this._keyPressHandled) {
|
if (this._keyPressHandled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+19
-2
@@ -436,10 +436,27 @@ declare module 'xterm' {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The element that the decoration is rendered to. This will be undefined
|
* The element that the decoration is rendered to. This will be undefined
|
||||||
* until it is rendered for the first time by @{link IDecoration.onRender}.
|
* until it is rendered for the first time by {@link IDecoration.onRender}.
|
||||||
* that.
|
* that.
|
||||||
*/
|
*/
|
||||||
element: HTMLElement | undefined;
|
element: HTMLElement | undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The options for the overview ruler that can be updated.
|
||||||
|
* This will only take effect when {@link IDecorationOptions.overviewRulerOptions}
|
||||||
|
* were provided initially.
|
||||||
|
*/
|
||||||
|
overviewRulerOptions?: Pick<
|
||||||
|
Options, 'color'>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overview ruler decoration options
|
||||||
|
*/
|
||||||
|
interface IDecorationOverviewRulerOptions {
|
||||||
|
color: string;
|
||||||
|
position?: 'left' | 'center' | 'right' | 'full';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -481,7 +498,7 @@ declare module 'xterm' {
|
|||||||
* @param color The color of the decoration.
|
* @param color The color of the decoration.
|
||||||
* @param position The position of the decoration.
|
* @param position The position of the decoration.
|
||||||
*/
|
*/
|
||||||
readonly overviewRulerOptions?: IModelDecorationOverviewRulerOptions
|
overviewRulerOptions?: IDecorationOverviewRulerOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user