From cfe46cb68fe8073f10d08627fb15ea2d91322088 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 26 Jun 2021 19:27:31 -0700 Subject: linenoise: end-of-line/buffer selection glitch. In inclusive selection mode, when the selection is reversed (end point is before start), and the starting character is the end of the line or of the buffer, that character is not included in the highlight, as if non-inclusive selection were in effect. This doesn't affect the semantics of the selection, only the way it is rendered visually; the character which is not highlighted is still included in the selection. * linenoise/linenoise.c (sync_data_to_buf): Remove two bogus conditions from the line which extends the visual selection by one character: we must not avoid executing this logic if the current character is zero (end of buffer) or CR (end of line). --- linenoise/linenoise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index ed0cc5d1..c82e0ca2 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -965,7 +965,7 @@ static void sync_data_to_buf(lino_t *l) l->sel = pos; if (l->dend == dpos) l->end = pos; - if (l->dsel == dpos - 1 && rev && l->selinclusive && ch && ch != '\r') + if (l->dsel == dpos - 1 && rev && l->selinclusive) l->sel = pos; if (ch) { -- cgit v1.2.3