Linebreak status not cleared when printing on a row
Foot currently tracks hard linebreaks as a boolean on the row struct. It is set when the client applications prints a
\n, but not when foot auto-wraps.
The flag is cleared whenever the row is erased.
The flag is used when reflowing text (when resizing the window), and when extracting text from the grid (for example, when copying text with ctrl+shift+c).
Taking tmux as an example, it seems to move the cursor down the entire screen (to the status bar?), or possibly clearing the screen, by emitting lots of
\n. The cursor is then moved back up.
I.e. we'll have set the newline flag on each and every row. This flag is virtually never cleared, unless tmux is forced to re-render the affected lines.
This causes foot to insert linebreaks into text copied from tmux.
One way to solve this is use one of the attribute bits in the cell struct to track newlines. The newline flag would then be cleared whenever that cell is overwritten.
But, what do we do with this flag, that can potentially be set on each and every cell on a single row? My guess is, we'd only care about the last cell.
But if that's the case, we could just as well keep the per-row flag, and simply clear it whenever something is printed to any cell on that row.
To summarize, we can either:
- Add a
newlineflag bit to the cell struct. Set it on the cell the cursor is currently at when we see a
\n. It is "automatically" cleared when the cell is erased or overwritten.
- Keep the current
newlineflag in the row struct, but start clearing it as soon as we write something on the row.
Deleting a branch is permanent. It CANNOT be undone. Continue?