nano

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

commit e9fde7d7dc9ff975d4745ce519584a456970c982
parent fd3423f79a47a39d58239b8ad5dff3fb16c09620
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sat, 10 Dec 2016 19:38:03 +0100

mouse: use the correct screen width for calculating the cursor position

When there are line numbers, the effective available screen width is
smaller than COLS: editwincols.

This fixes https://savannah.gnu.org/bugs/?49821.

Diffstat:
Msrc/nano.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -1767,7 +1767,7 @@ int do_mouse(void) openfile->current->next && i < mouse_y; openfile->current = openfile->current->next, i++) { openfile->current_y = i; - i += strlenpt(openfile->current->data) / COLS; + i += strlenpt(openfile->current->data) / editwincols; } #ifdef DEBUG fprintf(stderr, "do_mouse(): moving to current_y = %ld, index i = %lu\n", @@ -1777,7 +1777,8 @@ int do_mouse(void) if (i > mouse_y) { openfile->current = openfile->current->prev; - openfile->current_x = actual_x(openfile->current->data, mouse_x + (mouse_y - openfile->current_y) * COLS); + openfile->current_x = actual_x(openfile->current->data, + mouse_x + (mouse_y - openfile->current_y) * editwincols); #ifdef DEBUG fprintf(stderr, "do_mouse(): i > mouse_y, mouse_x = %d, current_x to = %lu\n", mouse_x, (unsigned long)openfile->current_x);