Skip to content
Myr

tui/light: consume full 7-byte CSI sequences to prevent leftover printing (#4528)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

- Fix parsing in escSequence so 7-byte CSI forms (e.g. ESC [ 5 ; 10 ~) set *sz = 7 and the entire sequence is consumed. - Prevents trailing bytes (like 10~) from remaining in the input buffer and being printed as stray characters.

authored by Massimo Mund · committed by GitHub · parent ca29410 · Browse files · 1 file+3 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−0 removed

  • other:+3 added−0 removed

1 file+3 added−0 removed

modified:src/tui/light.go+3 added
477 unmodified lines
478 if r.buffer[3] == '~' {479 return Event{Delete, 0, nil}480 }481 if len(r.buffer) == 7 && r.buffer[6] == '~' && r.buffer[4] == '1' {482 *sz = 7483 switch r.buffer[5] {484 case '0':485 return Event{AltShiftDelete, 0, nil}486 case '1':
38 unmodified lines
525 if r.buffer[3] == '~' {526 return Event{PageUp, 0, nil}527 }528 if len(r.buffer) == 7 && r.buffer[6] == '~' && r.buffer[4] == '1' {529 *sz = 7530 switch r.buffer[5] {531 case '0':532 return Event{AltShiftPageUp, 0, nil}533 case '1':
36 unmodified lines
570 if r.buffer[3] == '~' {571 return Event{PageDown, 0, nil}572 }573 if len(r.buffer) == 7 && r.buffer[6] == '~' && r.buffer[4] == '1' {574 *sz = 7575 switch r.buffer[5] {576 case '0':577 return Event{AltShiftPageDown, 0, nil}578 case '1':
927 unmodified lines