mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-05 21:46:49 -04:00
WrapViewLinesToWidth counted the characters of ANSI escape sequences as if they were visible, so colored text wrapped earlier than the view does, and the number of lines it reported was too high. In a narrow terminal the divergence in the menu that offers to push a stack of branches, colored yellow, ended up on a line of its own even though it fitted. The tooltip of a disabled menu item, whose prefix is red, gets its height from the same function. Skip escape sequences when measuring the width, and never break a line inside one. gocui wraps parsed cells and never sees escape sequences, so this brings the two in line; the test's parity check now compares the wrapped lines with the escape sequences stripped. Only CSI sequences are recognized. Those are the color and style codes that lazygit puts into view content; hyperlinks (OSC 8) only occur in the main view, and gocui wraps that one itself. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>