mirror of
https://github.com/Eugeny/tabby.git
synced 2025-03-01 15:06:27 +08:00
use the upstream xtermjs
This commit is contained in:
parent
a64bbe145c
commit
21cfd14f1c
@ -17,7 +17,6 @@
|
||||
"author": "Eugene Pankov",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@terminus-term/xterm": "3.8.4",
|
||||
"@types/deep-equal": "^1.0.0",
|
||||
"@types/mz": "0.0.31",
|
||||
"@types/node": "7.0.12",
|
||||
@ -27,6 +26,7 @@
|
||||
"file-loader": "^0.11.2",
|
||||
"rage-edit": "1.2.0",
|
||||
"uuid": "^3.3.2",
|
||||
"xterm": "3.10.1",
|
||||
"xterm-addon-ligatures-tmp": "^0.1.0-beta-1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Frontend } from './frontend'
|
||||
import { Terminal, ITheme } from '@terminus-term/xterm'
|
||||
import * as fit from '@terminus-term/xterm/src/addons/fit/fit'
|
||||
import { Terminal, ITheme } from 'xterm'
|
||||
import * as fit from 'xterm/src/addons/fit/fit'
|
||||
import * as ligatures from 'xterm-addon-ligatures-tmp'
|
||||
import '@terminus-term/xterm/lib/xterm.css'
|
||||
import 'xterm/lib/xterm.css'
|
||||
import './xterm.css'
|
||||
import deepEqual = require('deep-equal')
|
||||
|
||||
@ -12,6 +12,7 @@ Terminal.applyAddon(ligatures)
|
||||
export class XTermFrontend extends Frontend {
|
||||
enableResizing = true
|
||||
xterm: Terminal
|
||||
xtermCore: any
|
||||
private configuredFontSize = 0
|
||||
private zoom = 0
|
||||
private resizeHandler: () => void
|
||||
@ -24,6 +25,7 @@ export class XTermFrontend extends Frontend {
|
||||
allowTransparency: true,
|
||||
enableBold: true,
|
||||
})
|
||||
this.xtermCore = (this.xterm as any)._core
|
||||
|
||||
this.xterm.on('data', data => {
|
||||
this.input.next(data)
|
||||
@ -39,6 +41,19 @@ export class XTermFrontend extends Frontend {
|
||||
this.copySelection()
|
||||
}
|
||||
})
|
||||
this.xterm.attachCustomKeyEventHandler((event: KeyboardEvent) => {
|
||||
if ((event.getModifierState('Control') || event.getModifierState('Meta')) && event.key.toLowerCase() === 'v') {
|
||||
event.preventDefault()
|
||||
return false
|
||||
}
|
||||
if (event.getModifierState('Meta') && event.key.startsWith('Arrow')) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
this.xtermCore._scrollToBottom = this.xtermCore.scrollToBottom.bind(this.xtermCore)
|
||||
this.xtermCore.scrollToBottom = () => null
|
||||
}
|
||||
|
||||
attach (host: HTMLElement): void {
|
||||
@ -88,23 +103,19 @@ export class XTermFrontend extends Frontend {
|
||||
}
|
||||
|
||||
visualBell (): void {
|
||||
(this.xterm as any).bell()
|
||||
this.xtermCore.bell()
|
||||
}
|
||||
|
||||
scrollToBottom (): void {
|
||||
this.xterm.scrollToBottom()
|
||||
this.xtermCore._scrollToBottom()
|
||||
}
|
||||
|
||||
configure (config: any): void {
|
||||
if (this.resizeHandler) {
|
||||
setTimeout(() => {
|
||||
try {
|
||||
this.resizeHandler()
|
||||
} catch (e) {
|
||||
// fit() might throw if xterm isn't fully attached yet
|
||||
}
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (this.xterm.cols && this.xterm.rows) {
|
||||
this.resizeHandler()
|
||||
}
|
||||
})
|
||||
this.xterm.setOption('fontFamily', `"${config.terminal.font}", "monospace-fallback", monospace`)
|
||||
this.xterm.setOption('bellStyle', config.terminal.bell)
|
||||
this.xterm.setOption('cursorStyle', {
|
||||
|
@ -2,18 +2,6 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@terminus-term/node-pty@0.8.0-1":
|
||||
version "0.8.0-1"
|
||||
resolved "https://registry.yarnpkg.com/@terminus-term/node-pty/-/node-pty-0.8.0-1.tgz#3cb682f2351179842d195c074acf7d5b54e96ffe"
|
||||
integrity sha512-mEP5zQC/yHtvCbYjdGmwzFkkdTqCe0Jfd1o35yzM9jfGrVpW9qlvo/ZrzyOLSH2tJlYRB5SqfdWlo/LVXrAEYA==
|
||||
dependencies:
|
||||
nan "2.10.0"
|
||||
|
||||
"@terminus-term/xterm@3.8.4":
|
||||
version "3.8.4"
|
||||
resolved "https://registry.yarnpkg.com/@terminus-term/xterm/-/xterm-3.8.4.tgz#c9a9d9e0d46dbd8a94e06384e2d7268d36f5b0c6"
|
||||
integrity sha512-DrxCjnJh9n3ivpldwI098PnuVYwg9e5lFlU8/1qfh/J/wFHbG3dX/bEtB4ynfTi3IXVJozFO2psD96+W2h3yeQ==
|
||||
|
||||
"@types/deep-equal@^1.0.0":
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/deep-equal/-/deep-equal-1.0.1.tgz#71cfabb247c22bcc16d536111f50c0ed12476b03"
|
||||
@ -160,6 +148,13 @@ nan@>=2.10.0, nan@^2.10.0:
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.11.1.tgz#90e22bccb8ca57ea4cd37cc83d3819b52eea6766"
|
||||
integrity sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==
|
||||
|
||||
node-pty@^0.8.0:
|
||||
version "0.8.0"
|
||||
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.8.0.tgz#08bccb633f49e2e3f7245eb56ea6b40f37ccd64f"
|
||||
integrity sha512-g5ggk3gN4gLrDmAllee5ScFyX3YzpOC/U8VJafha4pE7do0TIE1voiIxEbHSRUOPD1xYqmY+uHhOKAd3avbxGQ==
|
||||
dependencies:
|
||||
nan "2.10.0"
|
||||
|
||||
object-assign@^4.0.1:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
||||
@ -245,6 +240,11 @@ xterm-addon-ligatures-tmp@^0.1.0-beta-1:
|
||||
font-finder "^1.0.2"
|
||||
font-ligatures "^1.3.1"
|
||||
|
||||
xterm@3.10.1:
|
||||
version "3.10.1"
|
||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.10.1.tgz#14accf92772e5a6728f317a3c209ba714b73c8b5"
|
||||
integrity sha512-RHaUwJ8zwLiICu1QsXoxUHP+R2Pp8Rc8yVoNali/nKw3CVXwmXxT/4mgbk7U22psuNgOqLyI4Sg9nlQfYeTRQw==
|
||||
|
||||
yallist@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
|
||||
|
Loading…
Reference in New Issue
Block a user