mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-10 22:50:04 +00:00
ligatures support in xterm (fixes #417)
This commit is contained in:
parent
2b4d3e99b6
commit
a03d01d9ce
@ -26,7 +26,8 @@
|
|||||||
"file-loader": "^0.11.2",
|
"file-loader": "^0.11.2",
|
||||||
"rage-edit-tmp": "^1.1.0",
|
"rage-edit-tmp": "^1.1.0",
|
||||||
"uuid": "^3.3.2",
|
"uuid": "^3.3.2",
|
||||||
"xterm": "^3.8.0"
|
"xterm": "^3.8.0",
|
||||||
|
"xterm-addon-ligatures": "^0.1.0-beta-1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "4.0.1",
|
"@angular/common": "4.0.1",
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { Frontend } from './frontend'
|
import { Frontend } from './frontend'
|
||||||
import { Terminal, ITheme } from 'xterm'
|
import { Terminal, ITheme } from 'xterm'
|
||||||
import * as fit from 'xterm/lib/addons/fit/fit'
|
import * as fit from 'xterm/lib/addons/fit/fit'
|
||||||
|
import * as ligatures from 'xterm-addon-ligatures/src'
|
||||||
import 'xterm/dist/xterm.css'
|
import 'xterm/dist/xterm.css'
|
||||||
import deepEqual = require('deep-equal')
|
import deepEqual = require('deep-equal')
|
||||||
|
|
||||||
Terminal.applyAddon(fit)
|
Terminal.applyAddon(fit)
|
||||||
|
Terminal.applyAddon(ligatures)
|
||||||
|
|
||||||
export class XTermFrontend extends Frontend {
|
export class XTermFrontend extends Frontend {
|
||||||
enableResizing = true
|
enableResizing = true
|
||||||
@ -21,17 +23,6 @@ export class XTermFrontend extends Frontend {
|
|||||||
enableBold: true,
|
enableBold: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
const initGlobal = (this.xterm as any)._core._initGlobal.bind((this.xterm as any)._core);
|
|
||||||
(this.xterm as any)._core._initGlobal = () => {
|
|
||||||
this.xterm.textarea.addEventListener('paste', e => {
|
|
||||||
e.clipboardData = null
|
|
||||||
})
|
|
||||||
this.xterm.element.addEventListener('paste', e => {
|
|
||||||
e.clipboardData = null
|
|
||||||
})
|
|
||||||
initGlobal()
|
|
||||||
}
|
|
||||||
|
|
||||||
this.xterm.on('data', data => {
|
this.xterm.on('data', data => {
|
||||||
this.input.next(data)
|
this.input.next(data)
|
||||||
})
|
})
|
||||||
@ -46,7 +37,7 @@ export class XTermFrontend extends Frontend {
|
|||||||
attach (host: HTMLElement): void {
|
attach (host: HTMLElement): void {
|
||||||
this.xterm.open(host)
|
this.xterm.open(host)
|
||||||
this.ready.next(null)
|
this.ready.next(null)
|
||||||
this.ready.complete();
|
this.ready.complete()
|
||||||
|
|
||||||
this.resizeHandler = () => (this.xterm as any).fit()
|
this.resizeHandler = () => (this.xterm as any).fit()
|
||||||
window.addEventListener('resize', this.resizeHandler)
|
window.addEventListener('resize', this.resizeHandler)
|
||||||
@ -128,6 +119,10 @@ export class XTermFrontend extends Frontend {
|
|||||||
this.xterm.setOption('theme', theme)
|
this.xterm.setOption('theme', theme)
|
||||||
this.configuredTheme = theme
|
this.configuredTheme = theme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.terminal.ligatures && this.xterm.element) {
|
||||||
|
(this.xterm as any).enableLigatures()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setZoom (zoom: number): void {
|
setZoom (zoom: number): void {
|
||||||
|
@ -71,6 +71,23 @@ file-loader@^0.11.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
loader-utils "^1.0.2"
|
loader-utils "^1.0.2"
|
||||||
|
|
||||||
|
font-finder@^1.0.2, font-finder@^1.0.3:
|
||||||
|
version "1.0.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/font-finder/-/font-finder-1.0.4.tgz#2ca944954dd8d0e1b5bdc4c596cc08607761d89b"
|
||||||
|
integrity sha512-naF16RpjWUTFLqzhmdivYpBCrqySN6PI+a4GPtoEsCdvOpbKYTGeTjO7mxh3Wwjz4xKU+Oqx9kwOcteLDeMFQA==
|
||||||
|
dependencies:
|
||||||
|
get-system-fonts "^2.0.0"
|
||||||
|
promise-stream-reader "^1.0.1"
|
||||||
|
|
||||||
|
font-ligatures@^1.3.1:
|
||||||
|
version "1.3.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/font-ligatures/-/font-ligatures-1.3.2.tgz#227eb5fc38fef34b5373aa19b555320b82842a71"
|
||||||
|
integrity sha512-h9t+gvKVr/c2GnQs4GhXHY39/qyLlXNaIxupU1cxj7YOXEFT8+sJfcchIrZ9UETZUUT7dNcI7RDOXN7gFtuw2g==
|
||||||
|
dependencies:
|
||||||
|
font-finder "^1.0.3"
|
||||||
|
lru-cache "^4.1.3"
|
||||||
|
opentype.js "^0.8.0"
|
||||||
|
|
||||||
font-manager@0.3.0:
|
font-manager@0.3.0:
|
||||||
version "0.3.0"
|
version "0.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/font-manager/-/font-manager-0.3.0.tgz#9efdc13e521a3d8752e7ab56c3938818043a311f"
|
resolved "https://registry.yarnpkg.com/font-manager/-/font-manager-0.3.0.tgz#9efdc13e521a3d8752e7ab56c3938818043a311f"
|
||||||
@ -78,6 +95,11 @@ font-manager@0.3.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
nan ">=2.10.0"
|
nan ">=2.10.0"
|
||||||
|
|
||||||
|
get-system-fonts@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-system-fonts/-/get-system-fonts-2.0.0.tgz#a43b9a33f05c0715a60176d2aad5ce6e98f0a3c6"
|
||||||
|
integrity sha512-iiM/DavyF2nnLdELzPBSHojzQJVai9WiwrRzn5gp2dutJuerC8qHyBoh4lxfVdKGbnb9eZ4p8Oefbuc3yExB7Q==
|
||||||
|
|
||||||
hterm-umdjs@1.4.1:
|
hterm-umdjs@1.4.1:
|
||||||
version "1.4.1"
|
version "1.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/hterm-umdjs/-/hterm-umdjs-1.4.1.tgz#0cd5352eaf927c70b83c36146cf2c2a281dba957"
|
resolved "https://registry.yarnpkg.com/hterm-umdjs/-/hterm-umdjs-1.4.1.tgz#0cd5352eaf927c70b83c36146cf2c2a281dba957"
|
||||||
@ -97,6 +119,14 @@ loader-utils@^1.0.2:
|
|||||||
emojis-list "^2.0.0"
|
emojis-list "^2.0.0"
|
||||||
json5 "^0.5.0"
|
json5 "^0.5.0"
|
||||||
|
|
||||||
|
lru-cache@^4.1.3:
|
||||||
|
version "4.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c"
|
||||||
|
integrity sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==
|
||||||
|
dependencies:
|
||||||
|
pseudomap "^1.0.2"
|
||||||
|
yallist "^2.1.2"
|
||||||
|
|
||||||
macos-native-processlist@^1.0.0:
|
macos-native-processlist@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/macos-native-processlist/-/macos-native-processlist-1.0.0.tgz#1dcf1fac554e057f90c6451c39420e065d186a68"
|
resolved "https://registry.yarnpkg.com/macos-native-processlist/-/macos-native-processlist-1.0.0.tgz#1dcf1fac554e057f90c6451c39420e065d186a68"
|
||||||
@ -130,6 +160,18 @@ object-assign@^4.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
||||||
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
|
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
|
||||||
|
|
||||||
|
opentype.js@^0.8.0:
|
||||||
|
version "0.8.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/opentype.js/-/opentype.js-0.8.0.tgz#acabcfa1642fbe894a3e4d759e43ba694e02bd35"
|
||||||
|
integrity sha1-rKvPoWQvvolKPk11nkO6aU4CvTU=
|
||||||
|
dependencies:
|
||||||
|
tiny-inflate "^1.0.2"
|
||||||
|
|
||||||
|
promise-stream-reader@^1.0.1:
|
||||||
|
version "1.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/promise-stream-reader/-/promise-stream-reader-1.0.1.tgz#4e793a79c9d49a73ccd947c6da9c127f12923649"
|
||||||
|
integrity sha512-Tnxit5trUjBAqqZCGWwjyxhmgMN4hGrtpW3Oc/tRI4bpm/O2+ej72BB08l6JBnGQgVDGCLvHFGjGgQS6vzhwXg==
|
||||||
|
|
||||||
ps-node@^0.1.6:
|
ps-node@^0.1.6:
|
||||||
version "0.1.6"
|
version "0.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/ps-node/-/ps-node-0.1.6.tgz#9af67a99d7b1d0132e51a503099d38a8d2ace2c3"
|
resolved "https://registry.yarnpkg.com/ps-node/-/ps-node-0.1.6.tgz#9af67a99d7b1d0132e51a503099d38a8d2ace2c3"
|
||||||
@ -137,6 +179,11 @@ ps-node@^0.1.6:
|
|||||||
dependencies:
|
dependencies:
|
||||||
table-parser "^0.1.3"
|
table-parser "^0.1.3"
|
||||||
|
|
||||||
|
pseudomap@^1.0.2:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
|
||||||
|
integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM=
|
||||||
|
|
||||||
rage-edit-tmp@^1.1.0:
|
rage-edit-tmp@^1.1.0:
|
||||||
version "1.1.0"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/rage-edit-tmp/-/rage-edit-tmp-1.1.0.tgz#fc5d76716d2fe2cf97dcafbf3e26753e3a08e3b2"
|
resolved "https://registry.yarnpkg.com/rage-edit-tmp/-/rage-edit-tmp-1.1.0.tgz#fc5d76716d2fe2cf97dcafbf3e26753e3a08e3b2"
|
||||||
@ -168,12 +215,30 @@ thenify-all@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
any-promise "^1.0.0"
|
any-promise "^1.0.0"
|
||||||
|
|
||||||
|
tiny-inflate@^1.0.2:
|
||||||
|
version "1.0.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/tiny-inflate/-/tiny-inflate-1.0.2.tgz#93d9decffc8805bd57eae4310f0b745e9b6fb3a7"
|
||||||
|
integrity sha1-k9nez/yIBb1X6uQxDwt0Xptvs6c=
|
||||||
|
|
||||||
uuid@^3.3.2:
|
uuid@^3.3.2:
|
||||||
version "3.3.2"
|
version "3.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
|
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131"
|
||||||
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
|
integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==
|
||||||
|
|
||||||
|
xterm-addon-ligatures@^0.1.0-beta-1:
|
||||||
|
version "0.1.0-beta-1"
|
||||||
|
resolved "https://registry.yarnpkg.com/xterm-addon-ligatures/-/xterm-addon-ligatures-0.1.0-beta-1.tgz#b2f68bbafd1e616893c78a4b16d1fdaee080c019"
|
||||||
|
integrity sha512-wGoo+AlTTKzwMI5+hQBoC6P0SVV3etpUnm11lVpfyPUmhkoV+YrrvYEPmHRkjitgp5VzOk640XilfTOfm7F5Vg==
|
||||||
|
dependencies:
|
||||||
|
font-finder "^1.0.2"
|
||||||
|
font-ligatures "^1.3.1"
|
||||||
|
|
||||||
xterm@^3.8.0:
|
xterm@^3.8.0:
|
||||||
version "3.8.0"
|
version "3.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.8.0.tgz#55d1de518bdc9c9793823f5e4e97d6898972938d"
|
resolved "https://registry.yarnpkg.com/xterm/-/xterm-3.8.0.tgz#55d1de518bdc9c9793823f5e4e97d6898972938d"
|
||||||
integrity sha512-rS3HLryuMWbLsv98+jVVSUXCxmoyXPwqwJNC0ad0VSMdXgl65LefPztQVwfurkaF7kM7ZSgM8eJjnJ9kkdoR1w==
|
integrity sha512-rS3HLryuMWbLsv98+jVVSUXCxmoyXPwqwJNC0ad0VSMdXgl65LefPztQVwfurkaF7kM7ZSgM8eJjnJ9kkdoR1w==
|
||||||
|
|
||||||
|
yallist@^2.1.2:
|
||||||
|
version "2.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
|
||||||
|
integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user