Skip to content

Commit

Permalink
bumped xterm, check bracketedPaste state via terminal modes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Sep 9, 2021
1 parent d6fa3b0 commit a87d887
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 39 deletions.
10 changes: 5 additions & 5 deletions tabby-terminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
"ps-node": "^0.1.6",
"runes": "^0.4.2",
"utils-decorators": "^1.8.1",
"xterm": "npm:@tabby-gang/xterm@4.14.0-beta.3",
"xterm": "npm:@tabby-gang/xterm@4.14.0",
"xterm-addon-fit": "^0.5.0",
"xterm-addon-ligatures": "^0.5.0",
"xterm-addon-search": "^0.8.0",
"xterm-addon-serialize": "^0.5.0",
"xterm-addon-unicode11": "^0.2.0",
"xterm-addon-webgl": "^0.11.0",
"xterm-addon-search": "^0.8.1",
"xterm-addon-serialize": "^0.6.0",
"xterm-addon-unicode11": "^0.3.0",
"xterm-addon-webgl": "^0.11.2",
"zmodem.js": "^0.1.9"
},
"peerDependencies": {
Expand Down
10 changes: 1 addition & 9 deletions tabby-terminal/src/api/baseTerminalTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
private termContainerSubscriptions = new SubscriptionContainer()
private allFocusModeSubscription: Subscription|null = null
private sessionHandlers = new SubscriptionContainer()
private sessionSupportsBracketedPaste = false
private spinner = new Spinner({
stream: {
write: x => {
Expand Down Expand Up @@ -418,19 +417,12 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
}
}

if (data.includes('\x1b[?2004h')) {
this.sessionSupportsBracketedPaste = true
}
if (data.includes('\x1b[?2004l')) {
this.sessionSupportsBracketedPaste = false
}

this.frontend.write(data)
}

async paste (): Promise<void> {
let data = this.platform.readClipboard()
if (this.config.store.terminal.bracketedPaste && this.sessionSupportsBracketedPaste) {
if (this.config.store.terminal.bracketedPaste && this.frontend?.supportsBracketedPaste()) {
data = `\x1b[200~${data}\x1b[201~`
}
if (this.hostApp.platform === Platform.Windows) {
Expand Down
2 changes: 1 addition & 1 deletion tabby-terminal/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class TerminalConfigProvider extends ConfigProvider {
fallbackFont: null,
linePadding: 0,
bell: 'off',
bracketedPaste: false,
bracketedPaste: true,
background: 'theme',
ligatures: false,
cursor: 'block',
Expand Down
2 changes: 2 additions & 0 deletions tabby-terminal/src/frontends/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,6 @@ export abstract class Frontend {

abstract saveState (): any
abstract restoreState (state: string): void

abstract supportsBracketedPaste (): boolean
}
4 changes: 4 additions & 0 deletions tabby-terminal/src/frontends/xtermFrontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ export class XTermFrontend extends Frontend {
this.xterm.write(state)
}

supportsBracketedPaste (): boolean {
return this.xterm.modes.bracketedPasteMode
}

private setFontSize () {
const scale = Math.pow(1.1, this.zoom)
this.xterm.setOption('fontSize', this.configuredFontSize * scale)
Expand Down
48 changes: 24 additions & 24 deletions tabby-terminal/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,30 +183,30 @@ xterm-addon-ligatures@^0.5.0:
font-finder "^1.1.0"
font-ligatures "^1.4.0"

xterm-addon-search@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.8.0.tgz#e33eab918df7eac7e7baf95dd2b3d14133754881"
integrity sha512-MPJGPVPpHRUw9cLIuqQbrVepmENMOybVUSxIALz5h1ryyQBrVqVujq2hL5aroX5/dZJoHx9lGHQTVLQ07SKgKA==

xterm-addon-serialize@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/xterm-addon-serialize/-/xterm-addon-serialize-0.5.0.tgz#b6967d573e8c231fbb58c06fdc86871ba1e7a4bc"
integrity sha512-NueZvbBGQvWDNBhA02/ZkPDq2yFlCqvwy7XhYLqRWAsvjGYkqZg3Py9eoLw4j7+WIhuLK4czswUYa2ntwKC3QQ==

xterm-addon-unicode11@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.2.0.tgz#9ed0c482b353908bba27778893ca80823382737c"
integrity sha512-rjFDItPc/IDoSiEnoDFwKroNwLD/7t9vYKENjrcKVZg5tgJuuUj8D4rZtP6iVCjSB1LTLYmUs4L/EmCqIyLR/Q==

xterm-addon-webgl@^0.11.0:
version "0.11.1"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.11.1.tgz#33dd250ab52e9f51d2ff52396447962e6f53e24c"
integrity sha512-xF6DnEoV+rPtzetMBXBZVe1kLKtus7AKdEcyfq2eMHQzhaRvC+pfnU+XiCXC85kueguqu2UkBHXZs5mihK9jOQ==

"xterm@npm:@tabby-gang/xterm@4.14.0-beta.3":
version "4.14.0-beta.3"
resolved "https://registry.yarnpkg.com/@tabby-gang/xterm/-/xterm-4.14.0-beta.3.tgz#2e06e59edcff39710a7c8c79dc1b2ae040f101b0"
integrity sha512-DimzmYmKfwj51ay7IsYOtwfThRYMbAZ4bJHBy7RgiVfsJCrypRlf+s4ofz29Hhw1dohNA67ko34dFaNJt2NKmA==
xterm-addon-search@^0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/xterm-addon-search/-/xterm-addon-search-0.8.1.tgz#dfc557e9bcf5fd8ed96292c0d271aa865bc545d5"
integrity sha512-OtOaC9gxD2Q4ZnjZrCSRZmKLwwUjXX3gP7mIzq8Rs50317DGRDqgTLuHTYv/Nx/LvI5ceVFRYCxK36Ixs1nXNw==

xterm-addon-serialize@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/xterm-addon-serialize/-/xterm-addon-serialize-0.6.0.tgz#3c967428de2cfd257a09066ef36e9aeba9817fe9"
integrity sha512-0D7nNdfvRsGhDdLgMIt1jYiYSVlvo18QRVkD4toa+3XcXr4G58FLbKu/gdfCt7da4aj7UIHbnOCexI0BncbVMA==

xterm-addon-unicode11@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/xterm-addon-unicode11/-/xterm-addon-unicode11-0.3.0.tgz#e4435c3c91a5294a7eb8b79c380acbb28a659463"
integrity sha512-x5fHDZT2j9tlTlHnzPHt++9uKZ2kJ/lYQOj3L6xJA22xoJsS8UQRw/5YIFg2FUHqEAbV77Z1fZij/9NycMSH/A==

xterm-addon-webgl@^0.11.2:
version "0.11.2"
resolved "https://registry.yarnpkg.com/xterm-addon-webgl/-/xterm-addon-webgl-0.11.2.tgz#eeb01f85cb35b0e47d1a3b691d4c6de8b2584c8e"
integrity sha512-eEOKEIMZO0IRb+UTHhTaUwxpD1cu7Zqr+jdUfhDv9cfVieg9c4mcRn9RWvNGlprGdlLmOSTUByhm8ve6qAc4HQ==

"xterm@npm:@tabby-gang/xterm@4.14.0":
version "4.14.0"
resolved "https://registry.yarnpkg.com/@tabby-gang/xterm/-/xterm-4.14.0.tgz#4f86c17b5464302f3d011eb79d00b2c7f7b1a548"
integrity sha512-cUh0GyXdL7FgcdizJ83JItY42OhLyxGvUprG91bpLVGPJ6CBK+9cO+fEOl/Kcfx9fUyGW6Y5EzANg9LxXBoqcQ==

yallist@^4.0.0:
version "4.0.0"
Expand Down

0 comments on commit a87d887

Please sign in to comment.