mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-10-06 05:57:38 -04:00
A reader that parses a view's content rather than showing it wants the text the writer wrote, and the cells don't always spell it. A tab is expanded into the spaces it fills, so a line read back from the cells ends in one to four spaces where the writer put a tab. A carriage return moves the write cursor back to the start of the line, so the text written after it overwrites what came before. The parser of the main view's diff, which the next commit adds, meets the first case in every header of a file whose path contains a space. git terminates the path field of a "---" or "+++" line with a tab then, and a parser reading the cells takes the spaces the tab became for part of the path. That path names a file that doesn't exist, so the file's lines can't be acted on. Keep the text as written per line, from the first character on that the cells spell differently, so that a line without a tab or a carriage return costs nothing. LinesAsWritten hands it out the way BufferLines hands out the cells' text. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>