mirror of
https://github.com/block/buzz.git
synced 2026-11-15 22:02:04 +00:00
Wren caught that the one negation was executed by everything and asserted by nothing. The frontend test proved a wheel delta reaches IPC as `lines: -2`; the engine tests proved `scroll(+2)` goes back into history. Neither ran the conversion between them, so deleting `-lines` from `terminal_scroll` left both suites green and reversed the terminal on a real trackpad. Reproduced before fixing: that mutant SURVIVED the full `buzz-terminal` and `buzz-desktop --lib` suites. The negation becomes `engine_scroll_lines`, a named function rather than a `-` in an argument list, because a conversion with no name has nowhere to hang an assertion. Three tests: the arithmetic with the direction in the test name, an end-to-end pass that drives a real `SharedTerminal` through the helper and asserts on the text that lands on screen -- the unit alone would still pass if the engine read the sign the other way -- and the `i32::MIN` case. `saturating_neg` rather than unary negation, also Wren's: `lines` arrives over IPC, and `-i32::MIN` panics in debug and wraps back to `i32::MIN` in release. The release case is the dangerous one, silently scrolling the wrong way on a crafted command. Saturating keeps the direction the caller asked for and lets the engine clamp. Co-authored-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com> Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>