teken, vt(4): Parse the "Cursor style" escape sequence
The escape sequence (e.g. `^[[2 q`) was unsupported before and the letter `q` was displayed as a typed character. The sequence is used by Neovim for instance. Now, it is properly parsed. However, it is ignored, so it won't change the cursor style. Because the escape sequence contains a space character, the `gensequences` script had to be modified to support that. In the `sequences` file, a space is represented as the string `SP`.
This commit is contained in:
parent
b7faa59dee
commit
8dcd2ed3c9
@ -35,6 +35,15 @@ function die(msg) {
|
||||
function cchar(str) {
|
||||
if (str == "^[")
|
||||
return "\\x1B";
|
||||
if (str == "SP")
|
||||
return " ";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function csequence(str) {
|
||||
if (str == "SP")
|
||||
return " ";
|
||||
|
||||
return str;
|
||||
}
|
||||
@ -57,7 +66,7 @@ while (getline > 0) {
|
||||
prefix = "";
|
||||
l_prefix_name[""] = "teken_state_init";
|
||||
for (i = 1; i < nsequences; i++) {
|
||||
n = prefix sequence[i];
|
||||
n = prefix csequence(sequence[i]);
|
||||
l_prefix_parent[n] = prefix;
|
||||
l_prefix_suffix[n] = sequence[i];
|
||||
if (!l_prefix_name[n])
|
||||
|
@ -48,6 +48,7 @@ CUF Cursor Forward ^[ [ a n
|
||||
CUP Cursor Position ^[ [ H n n
|
||||
CUP Cursor Position ^[ [ f n n
|
||||
CUU Cursor Up ^[ [ A n
|
||||
CS Cursor style ^[ [ SP q r
|
||||
DA1 Primary Device Attributes ^[ [ c r
|
||||
DA2 Secondary Device Attributes ^[ [ > c r
|
||||
DC Delete character ^[ [ P n
|
||||
|
@ -371,6 +371,25 @@ teken_subr_cursor_up(teken_t *t, unsigned int nrows)
|
||||
teken_funcs_cursor(t);
|
||||
}
|
||||
|
||||
static void
|
||||
teken_subr_cursor_style(teken_t *t, unsigned int style)
|
||||
{
|
||||
|
||||
/* TODO */
|
||||
|
||||
/*
|
||||
* CSI Ps SP q
|
||||
* Set cursor style (DECSCUSR), VT520.
|
||||
* Ps = 0 -> blinking block.
|
||||
* Ps = 1 -> blinking block (default).
|
||||
* Ps = 2 -> steady block.
|
||||
* Ps = 3 -> blinking underline.
|
||||
* Ps = 4 -> steady underline.
|
||||
* Ps = 5 -> blinking bar (xterm).
|
||||
* Ps = 6 -> steady bar (xterm).
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
teken_subr_delete_character(const teken_t *t, unsigned int ncols)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user