From ce8005545d5bc94775f616d0caacd55e691e400f Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 14 Feb 2020 22:39:26 +0100 Subject: term: convert cell 'linefeed' attribute to a row 'linebreak' property To do text reflow, we only need to know if a line has been explicitly linebreaked or not. If not, that means it wrapped, and that we should *not* insert a linebreak when reflowing text. When reflowing text, when reaching the end of a row in the old grid, only insert a linebreak in the new grid if the old row had been explicitly linebreaked. Furthermore, when reflowing text and wrapping a row in the new grid, mark the previous row as linebreaked if either the last cell was (the last column in the last row) empty, or the current cell (the first column in the new row) is empty. If both are non-empty, then we assume a linewrap. --- terminal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index 449a1329..1d19c9d7 100644 --- a/terminal.h +++ b/terminal.h @@ -42,8 +42,7 @@ struct attributes { uint32_t have_fg:1; uint32_t have_bg:1; uint32_t selected:2; - uint32_t linefeed:1; - uint32_t reserved:2; + uint32_t reserved:3; uint32_t bg:24; }; static_assert(sizeof(struct attributes) == 8, "bad size"); @@ -84,6 +83,7 @@ struct damage { struct row { struct cell *cells; bool dirty; + bool linebreak; }; struct grid { -- cgit v1.3