From: Michael D. Lowis Date: Wed, 26 Sep 2018 20:18:58 +0000 (-0400) Subject: fixed bug with trimming whitespace on last line of buffer X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=e64b07f1ba7200b6c8fde00b1ea7fcec54869133;p=projs%2Ftide.git fixed bug with trimming whitespace on last line of buffer --- 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') {