mirror of
https://github.com/Eugeny/tabby.git
synced 2024-12-09 06:20:22 +08:00
remember CSI color overrides (fixes #59)
This commit is contained in:
parent
7f45bb57fc
commit
8aff33d59c
@ -67,6 +67,41 @@ hterm.hterm.VT.CSI[' q'] = function (parseState) {
|
||||
this.terminal.applyCursorShape()
|
||||
}
|
||||
|
||||
hterm.hterm.VT.OSC['4'] = function (parseState) {
|
||||
let args = parseState.args[0].split(';')
|
||||
|
||||
let pairCount = args.length / 2
|
||||
let colorPalette = this.terminal.getTextAttributes().colorPalette
|
||||
let responseArray = []
|
||||
|
||||
for (let pairNumber = 0; pairNumber < pairCount; ++pairNumber) {
|
||||
let colorIndex = parseInt(args[pairNumber * 2])
|
||||
let colorValue = args[pairNumber * 2 + 1]
|
||||
|
||||
if (colorIndex >= colorPalette.length) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (colorValue === '?') {
|
||||
colorValue = hterm.lib.colors.rgbToX11(colorPalette[colorIndex])
|
||||
if (colorValue) {
|
||||
responseArray.push(colorIndex + ';' + colorValue)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
colorValue = hterm.lib.colors.x11ToCSS(colorValue)
|
||||
if (colorValue) {
|
||||
this.terminal.colorPaletteOverrides[colorIndex] = colorValue
|
||||
colorPalette[colorIndex] = colorValue
|
||||
}
|
||||
}
|
||||
|
||||
if (responseArray.length) {
|
||||
this.terminal.io.sendString('\x1b]4;' + responseArray.join(';') + '\x07')
|
||||
}
|
||||
}
|
||||
|
||||
const _collapseToEnd = Selection.prototype.collapseToEnd
|
||||
Selection.prototype.collapseToEnd = function () {
|
||||
try {
|
||||
|
@ -85,7 +85,10 @@ export class HTermContainer extends TermContainer {
|
||||
}
|
||||
|
||||
if (config.terminal.colorScheme.colors) {
|
||||
preferenceManager.set('color-palette-overrides', config.terminal.colorScheme.colors)
|
||||
preferenceManager.set(
|
||||
'color-palette-overrides',
|
||||
Object.assign([], config.terminal.colorScheme.colors, this.term.colorPaletteOverrides)
|
||||
)
|
||||
}
|
||||
if (config.terminal.colorScheme.cursor) {
|
||||
preferenceManager.set('cursor-color', config.terminal.colorScheme.cursor)
|
||||
@ -222,5 +225,7 @@ export class HTermContainer extends TermContainer {
|
||||
size.height += this.configuredLinePadding
|
||||
return size
|
||||
}
|
||||
|
||||
this.term.colorPaletteOverrides = []
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user