Commit 46ccc9ba authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

softwrap: improve left/right navigation across line boundaries

Using do_up() and do_end() when the user types <Left> at the start of
a line, and do_down() and do_home() when typing <Right> at line's end
can be problematic when tabs are wider than the screen, because those
functions convert indexes to columns and back again twice, thus causing
inaccuracies.  Therefore, simply adjust current and current_x directly,
and then redraw the screen.

This fixes https://savannah.gnu.org/bugs/index.php?51778.
parent e09dbf18
Showing with 10 additions and 4 deletions
+10 -4
......@@ -582,8 +582,11 @@ void do_left(void)
openfile->current_x = move_mbleft(openfile->current->data,
openfile->current_x);
else if (openfile->current != openfile->fileage) {
do_up_void();
do_end(FALSE);
openfile->current = openfile->current->prev;
openfile->current_x = strlen(openfile->current->data);
focusing = FALSE;
edit_redraw(openfile->current->next);
return;
}
......@@ -619,8 +622,11 @@ void do_right(void)
openfile->current_x = move_mbright(openfile->current->data,
openfile->current_x);
else if (openfile->current != openfile->filebot) {
do_home(FALSE);
do_down_void();
openfile->current = openfile->current->next;
openfile->current_x = 0;
focusing = FALSE;
edit_redraw(openfile->current->prev);
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment