From 0de55182ac6f9f69843aa3bbcaaba0adf896e323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 5 Jun 2021 13:41:17 +0200 Subject: [PATCH] =?UTF-8?q?selection:=20reset=20=E2=80=98empty=5Fcount?= =?UTF-8?q?=E2=80=99=20after=20we=E2=80=99ve=20emitted=20the=20empty=20cel?= =?UTF-8?q?ls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When marking and unmarking cells, we don’t highlight trailing empty cells. We do however highlight empty cells if they are followed by non-empty cells. I think this was an intentional choice. If one row ended with trailing empty cells, but *no* hard linebreak, then we’d continue on the next row, and emit all the empty cells once we hit a non-emtpy cell on the second row. But this is something that shouldn’t happen in any real-world use cases. --- selection.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selection.c b/selection.c index 2b312139..21969208 100644 --- a/selection.c +++ b/selection.c @@ -489,6 +489,7 @@ premark_selected(struct terminal *term, struct row *row, struct cell *cell, for (int i = 0; i < ctx->empty_count + 1; i++) row->cells[col - i].attrs.selected |= 2; + ctx->empty_count = 0; return true; } @@ -520,6 +521,7 @@ mark_selected(struct terminal *term, struct row *row, struct cell *cell, } } + ctx->empty_count = 0; return true; }