mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Remove altEscape DECSET mode and add support for alt+esc key
This commit is contained in:
@@ -1788,9 +1788,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
case 25: // show cursor
|
||||
this._coreService.isCursorHidden = false;
|
||||
break;
|
||||
case 1039:
|
||||
this._coreService.decPrivateModes.altEscMode = true;
|
||||
break;
|
||||
case 1048: // alt screen cursor
|
||||
this.saveCursor();
|
||||
break;
|
||||
@@ -2006,9 +2003,6 @@ export class InputHandler extends Disposable implements IInputHandler {
|
||||
case 25: // hide cursor
|
||||
this._coreService.isCursorHidden = true;
|
||||
break;
|
||||
case 1039:
|
||||
this._coreService.decPrivateModes.altEscMode = false;
|
||||
break;
|
||||
case 1048: // alt screen cursor
|
||||
this.restoreCursor();
|
||||
break;
|
||||
|
||||
+1
-1
@@ -1222,7 +1222,7 @@ export class Terminal extends Disposable implements ITerminal, IDisposable, IInp
|
||||
return false;
|
||||
}
|
||||
|
||||
const result = evaluateKeyboardEvent(event, this._coreService.decPrivateModes.altEscMode, this._coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);
|
||||
const result = evaluateKeyboardEvent(event, this._coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);
|
||||
|
||||
this.updateCursorStyle(event);
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ export class MockCoreService implements ICoreService {
|
||||
isCursorHidden: boolean = false;
|
||||
isFocused: boolean = false;
|
||||
decPrivateModes: IDecPrivateModes = {
|
||||
altEscMode: true,
|
||||
applicationCursorKeys: false,
|
||||
applicationKeypad: false,
|
||||
origin: false,
|
||||
|
||||
Vendored
-1
@@ -152,7 +152,6 @@ export interface IMarker extends IDisposable {
|
||||
}
|
||||
|
||||
export interface IDecPrivateModes {
|
||||
altEscMode: boolean;
|
||||
applicationCursorKeys: boolean;
|
||||
applicationKeypad: boolean;
|
||||
origin: boolean;
|
||||
|
||||
@@ -16,7 +16,6 @@ function testEvaluateKeyboardEvent(partialEvent: {
|
||||
key?: string;
|
||||
type?: string;
|
||||
}, partialOptions: {
|
||||
altEnterMode?: boolean;
|
||||
applicationCursorMode?: boolean;
|
||||
isMac?: boolean;
|
||||
macOptionIsMeta?: boolean;
|
||||
@@ -31,12 +30,11 @@ function testEvaluateKeyboardEvent(partialEvent: {
|
||||
type: partialEvent.type || ''
|
||||
};
|
||||
const options = {
|
||||
altEnterMode: partialOptions.altEnterMode || true,
|
||||
applicationCursorMode: partialOptions.applicationCursorMode || false,
|
||||
isMac: partialOptions.isMac || false,
|
||||
macOptionIsMeta: partialOptions.macOptionIsMeta || false
|
||||
};
|
||||
return evaluateKeyboardEvent(event, options.altEnterMode, options.applicationCursorMode, options.isMac, options.macOptionIsMeta);
|
||||
return evaluateKeyboardEvent(event, options.applicationCursorMode, options.isMac, options.macOptionIsMeta);
|
||||
}
|
||||
|
||||
describe('Keyboard', () => {
|
||||
@@ -91,6 +89,9 @@ describe('Keyboard', () => {
|
||||
it('should return \\x1b\\r for alt+enter', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 13 }).key, '\x1b\r');
|
||||
});
|
||||
it('should return \\x1b\\x1b for alt+esc', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 27 }).key, '\x1b\x1b');
|
||||
});
|
||||
it('should return \\x1b[5D for ctrl+left', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ ctrlKey: true, keyCode: 37 }).key, '\x1b[1;5D'); // CSI 5 D
|
||||
});
|
||||
@@ -146,6 +147,10 @@ describe('Keyboard', () => {
|
||||
it('should return \\x1ba for alt+a', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 65 }, { isMac: true, macOptionIsMeta: true }).key, '\x1ba');
|
||||
});
|
||||
|
||||
it('should return \\x1b\\x1b for alt+enter', () => {
|
||||
assert.equal(testEvaluateKeyboardEvent({ altKey: true, keyCode: 13 }, { isMac: true, macOptionIsMeta: true }).key, '\x1b\r');
|
||||
});
|
||||
});
|
||||
|
||||
it('should return \\x1b[5A for alt+up', () => {
|
||||
|
||||
@@ -37,7 +37,6 @@ const KEYCODE_KEY_MAPPINGS: { [key: number]: [string, string]} = {
|
||||
|
||||
export function evaluateKeyboardEvent(
|
||||
ev: IKeyboardEvent,
|
||||
altEscMode: boolean,
|
||||
applicationCursorMode: boolean,
|
||||
isMac: boolean,
|
||||
macOptionIsMeta: boolean
|
||||
@@ -104,7 +103,7 @@ export function evaluateKeyboardEvent(
|
||||
break;
|
||||
case 13:
|
||||
// return/enter
|
||||
if (altEscMode && modifiers === 2) {
|
||||
if (ev.altKey) {
|
||||
result.key = C0.ESC + C0.CR;
|
||||
}
|
||||
else {
|
||||
@@ -115,6 +114,9 @@ export function evaluateKeyboardEvent(
|
||||
case 27:
|
||||
// escape
|
||||
result.key = C0.ESC;
|
||||
if (ev.altKey) {
|
||||
result.key = C0.ESC + C0.ESC;
|
||||
}
|
||||
result.cancel = true;
|
||||
break;
|
||||
case 37:
|
||||
|
||||
Reference in New Issue
Block a user