diff options
| author | user <user@clank> | 2026-08-14 23:32:44 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-14 23:32:44 +0200 |
| commit | 7acf78ba9cb24b2fb93dca6163358d4cf69e73b2 (patch) | |
| tree | 51d7f6fa71b82b2323c795aedbdcd7d3ddb41e1f /src/expr.c | |
| parent | sl0ppty: re-emit what the program meant, not what it covers (diff) | |
| download | slosh-7acf78ba9cb24b2fb93dca6163358d4cf69e73b2.tar.gz slosh-7acf78ba9cb24b2fb93dca6163358d4cf69e73b2.tar.xz slosh-7acf78ba9cb24b2fb93dca6163358d4cf69e73b2.zip | |
sl0ppty: the graphics stream gives the cursor back
Reported as "the cursor is not rendered in zsh" in a newly spawned pane. It
was not about zsh, or about that pane: it was about the pane next to it,
which was animating an image.
Placing an image means parking the cursor on its target cell first, and the
graphics bytes go out *after* the cell diff -- deliberately, so a repainted
cell cannot land on top of a placement. That is also after the frame has put
the real cursor where the focused pane wants it. So with any image on screen,
the last instruction the terminal received every frame was "go to wherever
that image is", and the cursor sat there: in another pane, moving about with
the picture. With a bouncing DVD logo next door it is quite a sight.
gfx_begin() now opens the stream with DECSC and gfx_flush() closes it with
DECRC, so the whole thing is cursor-neutral no matter what it contains. The
save has to be written at the start of the frame rather than at flush time,
because transmissions are emitted as images are recorded and are already in
the buffer by then. A frame with nothing to say drops both and still emits
not one byte, which the test asserts, because a save/restore pair on every
idle frame is exactly the sort of cost that creeps in unnoticed.
Two tests: that the stream is bracketed (and that it really does move the
cursor, or the assertion proves nothing), and that an idle frame is empty.
One C trap worth the comment it now has: "\x1b7" is a *single* hex escape,
0x1b7, not ESC followed by 7. The compiler catches that one because it is out
of range -- and would not catch "\x1b1", which compiles quietly into one
wrong byte. Escape then digit is always two strings.
Diffstat (limited to 'src/expr.c')
0 files changed, 0 insertions, 0 deletions
