1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-27 07:22:31 +03:00

string-util: it's called OSC sequence, not CSO sequence

This commit is contained in:
Lennart Poettering 2024-10-31 09:51:32 +01:00
parent 3d8f2c1464
commit e65b0904a0

View File

@ -698,7 +698,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
STATE_OTHER, STATE_OTHER,
STATE_ESCAPE, STATE_ESCAPE,
STATE_CSI, STATE_CSI,
STATE_CSO, STATE_OSC,
} state = STATE_OTHER; } state = STATE_OTHER;
_cleanup_(memstream_done) MemStream m = {}; _cleanup_(memstream_done) MemStream m = {};
size_t isz, shift[2] = {}, n_carriage_returns = 0; size_t isz, shift[2] = {}, n_carriage_returns = 0;
@ -711,7 +711,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
* *
* 1. Replaces TABs by 8 spaces * 1. Replaces TABs by 8 spaces
* 2. Strips ANSI color sequences (a subset of CSI), i.e. ESC '[' 'm' sequences * 2. Strips ANSI color sequences (a subset of CSI), i.e. ESC '[' 'm' sequences
* 3. Strips ANSI operating system sequences (CSO), i.e. ESC ']' BEL sequences * 3. Strips ANSI operating system sequences (OSC), i.e. ESC ']' BEL sequences
* 4. Strip trailing \r characters (since they would "move the cursor", but have no * 4. Strip trailing \r characters (since they would "move the cursor", but have no
* other effect). * other effect).
* *
@ -719,7 +719,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
* are any other special characters. Truncated ANSI sequences are left-as is too. This call is * are any other special characters. Truncated ANSI sequences are left-as is too. This call is
* supposed to suppress the most basic formatting noise, but nothing else. * supposed to suppress the most basic formatting noise, but nothing else.
* *
* Why care for CSO sequences? Well, to undo what terminal_urlify() and friends generate. */ * Why care for OSC sequences? Well, to undo what terminal_urlify() and friends generate. */
isz = _isz ? *_isz : strlen(*ibuf); isz = _isz ? *_isz : strlen(*ibuf);
@ -766,8 +766,8 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
} else if (*i == '[') { /* ANSI CSI */ } else if (*i == '[') { /* ANSI CSI */
state = STATE_CSI; state = STATE_CSI;
begin = i + 1; begin = i + 1;
} else if (*i == ']') { /* ANSI CSO */ } else if (*i == ']') { /* ANSI OSC */
state = STATE_CSO; state = STATE_OSC;
begin = i + 1; begin = i + 1;
} else { } else {
fputc('\x1B', f); fputc('\x1B', f);
@ -793,7 +793,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
break; break;
case STATE_CSO: case STATE_OSC:
assert(n_carriage_returns == 0); assert(n_carriage_returns == 0);
if (i >= *ibuf + isz || /* EOT … */ if (i >= *ibuf + isz || /* EOT … */