aboutsummaryrefslogtreecommitdiff
path: root/grid.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-06-01 17:29:30 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-06-11 10:02:20 +0000
commit9567694bab7149afbb4e4fcc4c754272a8d25aba (patch)
treea60d48b198896162aa84cbf2e155d58827821f5d /grid.c
parentgrid: invert the default value of ‘linebreak’, from false to true (diff)
grid: reflow: don’t trim trailing empty cells from logical lines
When a line in the old grid (the one being reflowed) doesn’t have a hard linebreak, don’t trim trailing empty cells. Doing so means we’ll “compress” (remove) empty cells between text if/when we revert to a larger window size. The output from neofetch suffers from this; it prints a logo to the left, and system information to the right. The logo and the system info column is separated by empty cells (i.e. *not* spaces). If the window is reduced in size such that the system info is pushed to a new line, each logo line ends with a number of empty cells. The next time the window is resized, these empty cells were ignored (i.e. removed). That meant that once the window was enlarged again, the system info column was a) no longer aligned, and b) had been pulled closer to the logo. This patch doesn’t special case trailing empty cells when the line being reflowed doesn’t have a hard linebreak. This means e.g. ‘ls’ output is unaffected. Closes #1055
Diffstat (limited to 'grid.c')
-rw-r--r--grid.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/grid.c b/grid.c
index 736a9f64..bc1018d9 100644
--- a/grid.c
+++ b/grid.c
@@ -703,6 +703,11 @@ grid_resize_and_reflow(
}
}
+ if (!old_row->linebreak /*&& col_count > 0*/) {
+ /* Don’t truncate logical lines */
+ col_count = old_cols;
+ }
+
xassert(col_count >= 0 && col_count <= old_cols);
/* Do we have a (at least one) tracking point on this row */