mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
remember CSI color overrides (fixes #59)
This commit is contained in:
@@ -67,6 +67,41 @@ hterm.hterm.VT.CSI[' q'] = function (parseState) {
|
|||||||
this.terminal.applyCursorShape()
|
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
|
const _collapseToEnd = Selection.prototype.collapseToEnd
|
||||||
Selection.prototype.collapseToEnd = function () {
|
Selection.prototype.collapseToEnd = function () {
|
||||||
try {
|
try {
|
||||||
|
@@ -85,7 +85,10 @@ export class HTermContainer extends TermContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.terminal.colorScheme.colors) {
|
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) {
|
if (config.terminal.colorScheme.cursor) {
|
||||||
preferenceManager.set('cursor-color', 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
|
size.height += this.configuredLinePadding
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.term.colorPaletteOverrides = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user