Merge branch 'master' into 622_reflow3
This commit is contained in:
@@ -111,17 +111,17 @@ export class CompositionHelper {
|
|||||||
/**
|
/**
|
||||||
* Finalizes the composition, resuming regular input actions. This is called when a composition
|
* Finalizes the composition, resuming regular input actions. This is called when a composition
|
||||||
* is ending.
|
* is ending.
|
||||||
* @param waitForPropogation Whether to wait for events to propogate before sending
|
* @param waitForPropagation Whether to wait for events to propagate before sending
|
||||||
* the input. This should be false if a non-composition keystroke is entered before the
|
* the input. This should be false if a non-composition keystroke is entered before the
|
||||||
* compositionend event is triggered, such as enter, so that the composition is send before
|
* compositionend event is triggered, such as enter, so that the composition is sent before
|
||||||
* the command is executed.
|
* the command is executed.
|
||||||
*/
|
*/
|
||||||
private _finalizeComposition(waitForPropogation: boolean): void {
|
private _finalizeComposition(waitForPropagation: boolean): void {
|
||||||
this._compositionView.classList.remove('active');
|
this._compositionView.classList.remove('active');
|
||||||
this._isComposing = false;
|
this._isComposing = false;
|
||||||
this._clearTextareaPosition();
|
this._clearTextareaPosition();
|
||||||
|
|
||||||
if (!waitForPropogation) {
|
if (!waitForPropagation) {
|
||||||
// Cancel any delayed composition send requests and send the input immediately.
|
// Cancel any delayed composition send requests and send the input immediately.
|
||||||
this._isSendingComposition = false;
|
this._isSendingComposition = false;
|
||||||
const input = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);
|
const input = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);
|
||||||
@@ -136,8 +136,8 @@ export class CompositionHelper {
|
|||||||
|
|
||||||
// Since composition* events happen before the changes take place in the textarea on most
|
// Since composition* events happen before the changes take place in the textarea on most
|
||||||
// browsers, use a setTimeout with 0ms time to allow the native compositionend event to
|
// browsers, use a setTimeout with 0ms time to allow the native compositionend event to
|
||||||
// complete. This ensures the correct character is retrieved, this solution was used
|
// complete. This ensures the correct character is retrieved.
|
||||||
// because:
|
// This solution was used because:
|
||||||
// - The compositionend event's data property is unreliable, at least on Chromium
|
// - The compositionend event's data property is unreliable, at least on Chromium
|
||||||
// - The last compositionupdate event's data property does not always accurately describe
|
// - The last compositionupdate event's data property does not always accurately describe
|
||||||
// the character, a counter example being Korean where an ending consonsant can move to
|
// the character, a counter example being Korean where an ending consonsant can move to
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ export class SelectionManager extends EventEmitter implements ISelectionManager
|
|||||||
*/
|
*/
|
||||||
private _onMouseMove(event: MouseEvent): void {
|
private _onMouseMove(event: MouseEvent): void {
|
||||||
// If the mousemove listener is active it means that a selection is
|
// If the mousemove listener is active it means that a selection is
|
||||||
// currently being made, we should stop propogation to prevent mouse events
|
// currently being made, we should stop propagation to prevent mouse events
|
||||||
// to be sent to the pty.
|
// to be sent to the pty.
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1391,7 +1391,7 @@ export class Terminal extends EventEmitter implements ITerminal, IDisposable, II
|
|||||||
* processed by the terminal and what keys should not.
|
* processed by the terminal and what keys should not.
|
||||||
* @param customKeyEventHandler The custom KeyboardEvent handler to attach.
|
* @param customKeyEventHandler The custom KeyboardEvent handler to attach.
|
||||||
* This is a function that takes a KeyboardEvent, allowing consumers to stop
|
* This is a function that takes a KeyboardEvent, allowing consumers to stop
|
||||||
* propogation and/or prevent the default action. The function returns whether
|
* propagation and/or prevent the default action. The function returns whether
|
||||||
* the event should be processed by xterm.js.
|
* the event should be processed by xterm.js.
|
||||||
*/
|
*/
|
||||||
public attachCustomKeyEventHandler(customKeyEventHandler: CustomKeyEventHandler): void {
|
public attachCustomKeyEventHandler(customKeyEventHandler: CustomKeyEventHandler): void {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export class EventEmitter extends Disposable implements IEventEmitter, IDisposab
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a disposabe listener to the EventEmitter, returning the disposable.
|
* Adds a disposable listener to the EventEmitter, returning the disposable.
|
||||||
* @param type The event type.
|
* @param type The event type.
|
||||||
* @param handler The handler for the listener.
|
* @param handler The handler for the listener.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export function evaluateKeyboardEvent(
|
|||||||
): IKeyboardResult {
|
): IKeyboardResult {
|
||||||
const result: IKeyboardResult = {
|
const result: IKeyboardResult = {
|
||||||
type: KeyboardResultType.SEND_KEY,
|
type: KeyboardResultType.SEND_KEY,
|
||||||
// Whether to cancel event propogation (NOTE: this may not be needed since the event is
|
// Whether to cancel event propagation (NOTE: this may not be needed since the event is
|
||||||
// canceled at the end of keyDown
|
// canceled at the end of keyDown
|
||||||
cancel: false,
|
cancel: false,
|
||||||
// The new key even to emit
|
// The new key even to emit
|
||||||
@@ -349,9 +349,8 @@ export function evaluateKeyboardEvent(
|
|||||||
if (ev.keyCode === 65) { // cmd + a
|
if (ev.keyCode === 65) { // cmd + a
|
||||||
result.type = KeyboardResultType.SELECT_ALL;
|
result.type = KeyboardResultType.SELECT_ALL;
|
||||||
}
|
}
|
||||||
} else if (ev.key && !ev.ctrlKey && !ev.altKey && !ev.metaKey &&
|
} else if (ev.key && !ev.ctrlKey && !ev.altKey && !ev.metaKey && ev.keyCode >= 48 && ev.key.length === 1) {
|
||||||
ev.keyCode >= 48 && ev.keyCode !== 144 && ev.keyCode !== 145) {
|
// Include only keys that that result in a _single_ character; don't include num lock, volume up, etc.
|
||||||
// Include only keys that that result in a character; don't include num lock and scroll lock
|
|
||||||
result.key = ev.key;
|
result.key = ev.key;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -46,9 +46,10 @@ export class CharMeasure extends EventEmitter implements ICharMeasure {
|
|||||||
if (geometry.width === 0 || geometry.height === 0) {
|
if (geometry.width === 0 || geometry.height === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this._width !== geometry.width || this._height !== geometry.height) {
|
const adjustedHeight = Math.ceil(geometry.height);
|
||||||
|
if (this._width !== geometry.width || this._height !== adjustedHeight) {
|
||||||
this._width = geometry.width;
|
this._width = geometry.width;
|
||||||
this._height = Math.ceil(geometry.height);
|
this._height = adjustedHeight;
|
||||||
this.emit('charsizechanged');
|
this.emit('charsizechanged');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
import { IDisposable } from 'xterm';
|
import { IDisposable } from 'xterm';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a disposabe listener to a node in the DOM, returning the disposable.
|
* Adds a disposable listener to a node in the DOM, returning the disposable.
|
||||||
* @param type The event type.
|
* @param type The event type.
|
||||||
* @param handler The handler for the listener.
|
* @param handler The handler for the listener.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Vendored
+1
-1
@@ -465,7 +465,7 @@ declare module 'xterm' {
|
|||||||
* should be processed by the terminal and what keys should not.
|
* should be processed by the terminal and what keys should not.
|
||||||
* @param customKeyEventHandler The custom KeyboardEvent handler to attach.
|
* @param customKeyEventHandler The custom KeyboardEvent handler to attach.
|
||||||
* This is a function that takes a KeyboardEvent, allowing consumers to stop
|
* This is a function that takes a KeyboardEvent, allowing consumers to stop
|
||||||
* propogation and/or prevent the default action. The function returns
|
* propagation and/or prevent the default action. The function returns
|
||||||
* whether the event should be processed by xterm.js.
|
* whether the event should be processed by xterm.js.
|
||||||
*/
|
*/
|
||||||
attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void;
|
attachCustomKeyEventHandler(customKeyEventHandler: (event: KeyboardEvent) => boolean): void;
|
||||||
|
|||||||
Reference in New Issue
Block a user