nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 7f184ee2bad9e02f3c3329d7b8b2d9f0125fbe75
parent ec9fc5d3204d86f6d72e04922f16d12190dc77fa
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri,  6 Nov 2020 10:36:08 +0100

linting: avoid putting the cursor beyond the end of the line

Some linters report a column position (assuming a TAB to be 8 spaces)
instead of a byte index, so make sure that the cursor is not placed
out of bounds when interpreting such a column number as an index.

This fixes https://savannah.gnu.org/bugs/?59419.
Reported-by: Ava McWhorter <qwerty0s.e.m@gmail.com>

Bug existed since version 2.8.1, commit 2439e1e4.

Diffstat:
Msrc/text.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/text.c b/src/text.c @@ -2823,7 +2823,10 @@ void do_linter(void) } if (tmplint != curlint) { + /* Put the cursor at the reported position, but don't go beyond EOL + * when the second number is a column number instead of an index. */ goto_line_posx(curlint->lineno, curlint->colno - 1); + openfile->current_x = actual_x(openfile->current->data, openfile->placewewant); titlebar(NULL); adjust_viewport(CENTERING); #ifdef ENABLE_LINENUMBERS