grid: change default value of linebreak to true

This way, all lines are treated as having a hard linebreak, until it's
cleared when we do an auto-wrap.

This change alone causes issues when reflowing text, as now all
trailing lines in an otherwise empty window are treated as hard
linebreaks, causing the new grid to insert lots of unwanted, empty
lines.

Fix by doing two things:

* *clear* the linebreak flag when we pull in new lines for the new
  grid. We only want to set it explicitly, when an old row has its
  linebreak flag set.
* Coalesce empty lines with linebreak=true, and only "emit" them as
  new liens in the new grid if they are followed by non-empty lines.
This commit is contained in:
Daniel Eklöf 2025-03-04 08:34:18 +01:00
parent a80b32d006
commit 7b6efcf19a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 61 additions and 28 deletions

View file

@ -2057,7 +2057,7 @@ static inline void
erase_line(struct terminal *term, struct row *row)
{
erase_cell_range(term, row, 0, term->cols - 1);
row->linebreak = false;
row->linebreak = true;
row->shell_integration.prompt_marker = false;
row->shell_integration.cmd_start = -1;
row->shell_integration.cmd_end = -1;