aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-01-25 07:46:21 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-01-25 07:46:21 +0000
commit97385b007f2bb9cd54e701e5745d6e8d607513c2 (patch)
treecb23f69dd0a69284fb1c4ff1596d21626159bb5e
parentchangelog: cwd > 1024 chars (diff)
grid: reflow: regression: remove (truncate) SPACER cells at the end of line
When printing a double-width glyph at the end of the line, it will get pushed to the next line if there's only one cell left on the current line. That last cell on the current line is filled with a SPACER value. When reflowing the text, the SPACER cell should be "removed", so that the double-width glyph continues directly after the text on the previous line. 9567694bab7149afbb4e4fcc4c754272a8d25aba fixed an issue where reflowing e.g. neofetch output incorrectly removed spaces between the logo, and the system info. But also introduced a regression where SPACER values no longer are removed. This patch tries to fix it, by adding back empty cells, but NOT SPACER cells.
-rw-r--r--CHANGELOG.md4
-rw-r--r--grid.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b45aa01f..a249ef2d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -77,6 +77,10 @@
* `foot` and `footclient` hanging, or terminating with `SIGABRT`, when
starting inside a directory whose total length is more than 1024
characters.
+* Regression: reflowing (resizing the window) a line that ends with a
+ double-width glyph that was pushed to the next line due to there
+ being only one cell left on current line, did not remove the virtual
+ space inserted at the end of the current line.
[1918]: https://codeberg.org/dnkl/foot/issues/1918
diff --git a/grid.c b/grid.c
index 2f65a1dd..3f5c617d 100644
--- a/grid.c
+++ b/grid.c
@@ -930,7 +930,8 @@ grid_resize_and_reflow(
if (!old_row->linebreak && col_count > 0) {
/* Don't truncate logical lines */
- col_count = old_cols;
+ while (col_count < old_cols && old_row->cells[col_count].wc == 0)
+ col_count++;
}
xassert(col_count >= 0 && col_count <= old_cols);