mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-09 14:00:03 +00:00
cursor shape setting (fixes #55)
This commit is contained in:
parent
9bee253dd0
commit
0fe2de591a
@ -174,7 +174,8 @@
|
|||||||
[title]='idx',
|
[title]='idx',
|
||||||
)
|
)
|
||||||
|
|
||||||
.form-group
|
.d-flex
|
||||||
|
.form-group.mr-3
|
||||||
label Terminal background
|
label Terminal background
|
||||||
br
|
br
|
||||||
div(
|
div(
|
||||||
@ -194,6 +195,32 @@
|
|||||||
[value]='"colorScheme"'
|
[value]='"colorScheme"'
|
||||||
)
|
)
|
||||||
| From colors
|
| From colors
|
||||||
|
.form-group
|
||||||
|
label Cursor shape
|
||||||
|
br
|
||||||
|
div(
|
||||||
|
[(ngModel)]='config.store.terminal.cursor',
|
||||||
|
(ngModelChange)='config.save()',
|
||||||
|
ngbRadioGroup
|
||||||
|
)
|
||||||
|
label.btn.btn-secondary
|
||||||
|
input(
|
||||||
|
type='radio',
|
||||||
|
[value]='"block"'
|
||||||
|
)
|
||||||
|
| Block
|
||||||
|
label.btn.btn-secondary
|
||||||
|
input(
|
||||||
|
type='radio',
|
||||||
|
[value]='"underline"'
|
||||||
|
)
|
||||||
|
| Underline
|
||||||
|
label.btn.btn-secondary
|
||||||
|
input(
|
||||||
|
type='radio',
|
||||||
|
[value]='"beam"'
|
||||||
|
)
|
||||||
|
| Beam
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
label Shell
|
label Shell
|
||||||
|
@ -299,6 +299,12 @@ export class TerminalTabComponent extends BaseTabComponent {
|
|||||||
css += config.appearance.css
|
css += config.appearance.css
|
||||||
this.hterm.setCSS(css)
|
this.hterm.setCSS(css)
|
||||||
this.hterm.setBracketedPaste(config.terminal.bracketedPaste)
|
this.hterm.setBracketedPaste(config.terminal.bracketedPaste)
|
||||||
|
this.hterm.defaultCursorShape = {
|
||||||
|
block: hterm.hterm.Terminal.cursorShape.BLOCK,
|
||||||
|
underline: hterm.hterm.Terminal.cursorShape.UNDERLINE,
|
||||||
|
beam: hterm.hterm.Terminal.cursorShape.BEAM,
|
||||||
|
}[config.terminal.cursor]
|
||||||
|
this.hterm.applyCursorShape()
|
||||||
}
|
}
|
||||||
|
|
||||||
zoomIn () {
|
zoomIn () {
|
||||||
|
@ -8,6 +8,7 @@ export class TerminalConfigProvider extends ConfigProvider {
|
|||||||
bracketedPaste: false,
|
bracketedPaste: false,
|
||||||
background: 'theme',
|
background: 'theme',
|
||||||
ligatures: false,
|
ligatures: false,
|
||||||
|
cursor: 'block',
|
||||||
colorScheme: {
|
colorScheme: {
|
||||||
__nonStructural: true,
|
__nonStructural: true,
|
||||||
name: 'Material',
|
name: 'Material',
|
||||||
|
@ -40,3 +40,29 @@ hterm.lib.wc.charWidthDisregardAmbiguous = codepoint => {
|
|||||||
}
|
}
|
||||||
return oldCharWidthDisregardAmbiguous(codepoint)
|
return oldCharWidthDisregardAmbiguous(codepoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hterm.hterm.Terminal.prototype.applyCursorShape = function () {
|
||||||
|
let modes = [
|
||||||
|
[hterm.hterm.Terminal.cursorShape.BLOCK, true],
|
||||||
|
[this.defaultCursorShape || hterm.hterm.Terminal.cursorShape.BLOCK, false],
|
||||||
|
[hterm.hterm.Terminal.cursorShape.BLOCK, false],
|
||||||
|
[hterm.hterm.Terminal.cursorShape.UNDERLINE, true],
|
||||||
|
[hterm.hterm.Terminal.cursorShape.UNDERLINE, false],
|
||||||
|
[hterm.hterm.Terminal.cursorShape.BEAM, true],
|
||||||
|
[hterm.hterm.Terminal.cursorShape.BEAM, false],
|
||||||
|
]
|
||||||
|
let modeNumber = this.cursorMode || 1
|
||||||
|
console.log('mode', modeNumber)
|
||||||
|
if (modeNumber >= modes.length) {
|
||||||
|
console.warn('Unknown cursor style: ' + modeNumber)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setCursorShape(modes[modeNumber][0])
|
||||||
|
this.setCursorBlink(modes[modeNumber][1])
|
||||||
|
}
|
||||||
|
|
||||||
|
hterm.hterm.VT.CSI[' q'] = function (parseState) {
|
||||||
|
const arg = parseState.args[0]
|
||||||
|
this.terminal.cursorMode = arg
|
||||||
|
this.terminal.applyCursorShape()
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user