From 07652d3b9e58dd99f5fedd6776092ed815ccb7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 2 Jul 2021 16:31:46 +0200 Subject: [PATCH] term: rows printed to now defaults to having a hard linebreak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That is, instead of requiring a ā€˜\n’ to be printed, non-empty lines are now treated as having a hard linebreak by default. The linebreak is cleared on an explicit wrap. --- CHANGELOG.md | 5 +++++ terminal.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7dd2a15..dc969826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,11 @@ ## Unreleased ### Added ### Changed + +* Non-empty lines are now considered to have a hard linebreak, + _unless_ an actual word-wrap is inserted. + + ### Deprecated ### Removed ### Fixed diff --git a/terminal.c b/terminal.c index 6c175147..bede6811 100644 --- a/terminal.c +++ b/terminal.c @@ -2756,6 +2756,7 @@ print_linewrap(struct terminal *term) return; } + term->grid->cur_row->linebreak = false; term->grid->cursor.lcf = false; const int row = term->grid->cursor.point.row; @@ -2848,7 +2849,7 @@ term_print(struct terminal *term, wchar_t wc, int width) cell->attrs = term->vt.attrs; row->dirty = true; - row->linebreak = false; + row->linebreak = true; /* Advance cursor the 'additional' columns while dirty:ing the cells */ for (int i = 1; i < width && term->grid->cursor.point.col < term->cols - 1; i++) { @@ -2887,7 +2888,7 @@ ascii_printer_fast(struct terminal *term, wchar_t wc) cell->attrs = term->vt.attrs; row->dirty = true; - row->linebreak = false; + row->linebreak = true; /* Advance cursor */ if (unlikely(++term->grid->cursor.point.col >= term->cols)) {