From e64b07f1ba7200b6c8fde00b1ea7fcec54869133 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 26 Sep 2018 16:18:58 -0400 Subject: [PATCH] fixed bug with trimming whitespace on last line of buffer --- TODO.md | 4 +--- lib/buf.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 92042ea..6a4eccd 100644 --- a/TODO.md +++ b/TODO.md @@ -2,12 +2,10 @@ BUGS: -* trimming does not use a transaction -* trimming does not update selection properly +* no magic right click * use transaction processing for joining lines * implement mouse warping on search, jump to line, and focus change * gap buffer does not handle UTF-8 currently -* no magic right click * mouse selection handling when mouse moves outside region Up Next: diff --git a/lib/buf.c b/lib/buf.c index 06dfe01..d1adc38 100644 --- a/lib/buf.c +++ b/lib/buf.c @@ -157,7 +157,7 @@ static void trim_whitespace(Buf* buf) { unsigned prev = 1; buf->selection.beg = buf->selection.end = 0; buf_logstart(buf); - while (buf->selection.end < buf_end(buf) && prev != buf->selection.end) { + while (prev != buf->selection.end) { int r = getb(buf, buf->selection.end); /* If we reached a newline, then delete whatever we have selected */ if (r == '\r' || r == '\n') { -- 2.49.0