support REP (repeat) escape sequence
The sequence \e[Nb prints the last printed char N (more) times if it's printable, and it's ignored after newline or other control chars. This is Ecma-048/ANSI-X3.6 sequence and not DEC VT. It's supported by xterm, and ncurses uses it when possible, e.g. when TERM is xterm* (and with this commit also st*). xterm supports only codepoints<=255, possibly due to internal limits. We support any value/codepoint which was placed in a cell. To test: - tput rep 65 4 -> prints 'AAAA' - printf "\342\225\246\033[4b" -> prints U+2566 1+4 times.
This commit is contained in:
parent
ee4f3ae97b
commit
eb56c17d51
|
@ -1,4 +1,4 @@
|
|||
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.3 (453eb7, 2020-05-16) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
|
||||
Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.8.3 (113da4, 2020-05-16) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
|
||||
|
||||
For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/st-flexipatch/blob/master/patches.def.h):
|
||||
```c
|
||||
|
@ -15,7 +15,7 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
|
|||
|
||||
### Changelog:
|
||||
|
||||
2020-05-20 - Upgrade to 453eb7, 2020-05-09, removed visualbell 1, 2, 3 patches and force redraw after keypress due to incompatibility
|
||||
2020-05-20 - Upgrade to 113da4, 2020-05-09, removed visualbell 1, 2, 3 patches and force redraw after keypress due to incompatibility
|
||||
|
||||
2020-04-20 - Upgrade to c279f5, 2020-04-19, and added the force redraw on pselect after key is pressed patch and the externalpipein patch
|
||||
|
||||
|
|
10
st.c
10
st.c
|
@ -142,6 +142,7 @@ typedef struct {
|
|||
int charset; /* current charset */
|
||||
int icharset; /* selected charset for sequence */
|
||||
int *tabs;
|
||||
Rune lastc; /* last printed char outside of sequence, 0 if control */
|
||||
} Term;
|
||||
|
||||
/* CSI Escape sequence structs */
|
||||
|
@ -1793,6 +1794,12 @@ csihandle(void)
|
|||
if (csiescseq.arg[0] == 0)
|
||||
ttywrite(vtiden, strlen(vtiden), 0);
|
||||
break;
|
||||
case 'b': /* REP -- if last char is printable print it <n> more times */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
if (term.lastc)
|
||||
while (csiescseq.arg[0]-- > 0)
|
||||
tputc(term.lastc);
|
||||
break;
|
||||
case 'C': /* CUF -- Cursor <n> Forward */
|
||||
case 'a': /* HPR -- Cursor <n> Forward */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
|
@ -2543,6 +2550,8 @@ check_control_code:
|
|||
/*
|
||||
* control codes are not shown ever
|
||||
*/
|
||||
if (!term.esc)
|
||||
term.lastc = 0;
|
||||
return;
|
||||
} else if (term.esc & ESC_START) {
|
||||
if (term.esc & ESC_CSI) {
|
||||
|
@ -2592,6 +2601,7 @@ check_control_code:
|
|||
}
|
||||
|
||||
tsetchar(u, &term.c.attr, term.c.x, term.c.y);
|
||||
term.lastc = u;
|
||||
|
||||
if (width == 2) {
|
||||
gp->mode |= ATTR_WIDE;
|
||||
|
|
Loading…
Reference in New Issue