aboutsummaryrefslogtreecommitdiffstats
path: root/src/osc5577.c
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-17 14:22:38 +0200
committeruser <user@clank>2026-08-17 14:22:38 +0200
commitec91ccffe631ae34b111bf6161fd0e3c487f684c (patch)
tree4a9fdbb720d9bf03edd5f538d1d87afd2bf51bfb /src/osc5577.c
parentsl0ppty: clang-format, and a hook that runs it on what you staged (diff)
downloadslosh-ec91ccffe631ae34b111bf6161fd0e3c487f684c.tar.gz
slosh-ec91ccffe631ae34b111bf6161fd0e3c487f684c.tar.xz
slosh-ec91ccffe631ae34b111bf6161fd0e3c487f684c.zip
sl0ppty: clang-format the tree
The bumpy one. `make fmt` over every `.c` and `.h` outside `vendor/`: 32 files, 1,843 lines rewritten, no behaviour changed. Nothing here is worth reading -- the next commit adds it to `.git-blame-ignore-revs` so `git blame` walks past it. Two thirds of it is alignment the formatter now owns: trailing comments in a struct, continuation lines under a signature. The rest is the hand-packed tables opening up to one entry per line -- `ACTIONS`, `NAMED_KEYS`, `ACTION_HELP`. That is a real loss of density and a real gain in diffs: adding an action was a reflow of the block and is now one line. Anything worth keeping packed can be fenced with `// clang-format off`; nothing was, on the grounds that a table is the thing a formatter is for. **One change is not formatting.** `src/config.h` had three trailing comments glued onto one field: uint16_t hover_delay_ms; /* how long the pointer must rest to arm a guide */ /* how long an announcement stays up */ /* rows per wheel notch */ -- `toast_ms`'s and `scroll_lines`' comments, landed on their neighbour by an earlier edit, documenting the wrong things ever since. It is in this commit because it is what caught it: clang-format could not settle on that line, wrapping it one way and then re-indenting the wrap on a second pass, so `make fmt` was not idempotent. The comments are back where they belong and it is. Verified after the reformat, not before: `make clean && make all` is warning-free, `make retest` is 1801 checks green, and `make fmt` twice in a row changes nothing the second time. A formatter that alters behaviour would be worse than none, so the gate was the whole suite rather than a reading of the diff.
Diffstat (limited to 'src/osc5577.c')
-rw-r--r--src/osc5577.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/src/osc5577.c b/src/osc5577.c
index 35f23b4..dd2ec26 100644
--- a/src/osc5577.c
+++ b/src/osc5577.c
@@ -45,47 +45,47 @@ void osc_scan_feed(osc_scan_t *s, const uint8_t *data, size_t len,
for (size_t i = 0; i < len; i++) {
uint8_t c = data[i];
switch (s->state) {
- case OS_GROUND:
- if (c == 0x1b) s->state = OS_ESC;
- break;
+ case OS_GROUND:
+ if (c == 0x1b) s->state = OS_ESC;
+ break;
- case OS_ESC:
- if (c == ']') {
- s->state = OS_BODY;
- s->len = 0;
- s->overflow = false;
- } else {
- s->state = c == 0x1b ? OS_ESC : OS_GROUND;
- }
- break;
+ case OS_ESC:
+ if (c == ']') {
+ s->state = OS_BODY;
+ s->len = 0;
+ s->overflow = false;
+ } else {
+ s->state = c == 0x1b ? OS_ESC : OS_GROUND;
+ }
+ break;
- case OS_BODY:
- if (c == 0x07) { /* BEL terminator, as accepted for OSC 0/2 */
- if (!s->overflow) dispatch(s->buf, s->len, cb, ud);
- s->state = OS_GROUND;
- } else if (c == 0x1b) {
- s->state = OS_BODY_ESC;
- } else if (c < 0x20) {
- s->state = OS_GROUND; /* a control byte ends a malformed OSC */
- } else if (s->len < sizeof s->buf) {
- s->buf[s->len++] = (char)c;
- } else {
- s->overflow = true; /* keep scanning to the terminator, then drop */
- }
- break;
+ case OS_BODY:
+ if (c == 0x07) { /* BEL terminator, as accepted for OSC 0/2 */
+ if (!s->overflow) dispatch(s->buf, s->len, cb, ud);
+ s->state = OS_GROUND;
+ } else if (c == 0x1b) {
+ s->state = OS_BODY_ESC;
+ } else if (c < 0x20) {
+ s->state = OS_GROUND; /* a control byte ends a malformed OSC */
+ } else if (s->len < sizeof s->buf) {
+ s->buf[s->len++] = (char)c;
+ } else {
+ s->overflow = true; /* keep scanning to the terminator, then drop */
+ }
+ break;
- case OS_BODY_ESC:
- if (c == '\\') { /* ST */
- if (!s->overflow) dispatch(s->buf, s->len, cb, ud);
- s->state = OS_GROUND;
- } else if (c == ']') {
- s->state = OS_BODY; /* a new OSC started inside one: restart */
- s->len = 0;
- s->overflow = false;
- } else {
- s->state = OS_GROUND;
- }
- break;
+ case OS_BODY_ESC:
+ if (c == '\\') { /* ST */
+ if (!s->overflow) dispatch(s->buf, s->len, cb, ud);
+ s->state = OS_GROUND;
+ } else if (c == ']') {
+ s->state = OS_BODY; /* a new OSC started inside one: restart */
+ s->len = 0;
+ s->overflow = false;
+ } else {
+ s->state = OS_GROUND;
+ }
+ break;
}
}
}