提交 8aff33d5 编写于 作者: E Eugene Pankov

remember CSI color overrides (fixes #59)

上级 7f45bb57
......@@ -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 = []
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册