1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-24 02:53:43 +03:00

xterm: passthrough arrows with modifiers when in alternate mode - fixes #2328

This commit is contained in:
Eugene Pankov 2022-02-23 21:47:46 +01:00
parent 030ddc721d
commit d1ac265d79
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
2 changed files with 15 additions and 0 deletions

View File

@ -82,4 +82,5 @@ export abstract class Frontend {
abstract restoreState (state: string): void
abstract supportsBracketedPaste (): boolean
abstract isAlternateScreenActive (): boolean
}

View File

@ -86,6 +86,16 @@ export class XTermFrontend extends Frontend {
this.xterm.unicode.activeVersion = '11'
const keyboardEventHandler = (name: string, event: KeyboardEvent) => {
if (this.isAlternateScreenActive()) {
let modifiers = 0
modifiers += event.ctrlKey ? 1 : 0
modifiers += event.altKey ? 1 : 0
modifiers += event.shiftKey ? 1 : 0
modifiers += event.metaKey ? 1 : 0
if (event.key.startsWith('Arrow') && modifiers === 1) {
return true
}
}
this.hotkeysService.pushKeyEvent(name, event)
let ret = true
if (this.hotkeysService.matchActiveHotkey(true) !== null) {
@ -331,6 +341,10 @@ export class XTermFrontend extends Frontend {
return this.xterm.modes.bracketedPasteMode
}
isAlternateScreenActive (): boolean {
return this.xterm.buffer.active.type === 'alternate'
}
private setFontSize () {
const scale = Math.pow(1.1, this.zoom)
this.xterm.options.fontSize = this.configuredFontSize * scale