From fc367a32ebc7ed7059684233c80c06383cf91e6c Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 21 Aug 2017 21:57:25 +0200 Subject: [PATCH] moving: don't push x forward when backward movement lands on a split tab This fixes https://savannah.gnu.org/bugs/?51809. --- src/move.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/move.c b/src/move.c index 4ceec5fc..9b623c30 100644 --- a/src/move.c +++ b/src/move.c @@ -103,7 +103,7 @@ void do_page_up(void) } openfile->placewewant = leftedge + target_column; - openfile->current_x = proper_x(openfile->current->data, leftedge, + openfile->current_x = actual_x(openfile->current->data, actual_last_column(leftedge, target_column)); /* Move the viewport so that the cursor stays immobile, if possible. */ @@ -461,8 +461,6 @@ void do_end(void) * also scroll the screen one row, so the cursor stays in the same spot. */ void do_up(bool scroll_only) { - filestruct *was_current = openfile->current; - size_t was_x = openfile->current_x; size_t leftedge, target_column; /* When just scrolling and the top of the file is onscreen, get out. */ @@ -476,10 +474,8 @@ void do_up(bool scroll_only) if (go_back_chunks(1, &openfile->current, &leftedge) > 0) return; - openfile->current_x = proper_x(openfile->current->data, leftedge, + openfile->current_x = actual_x(openfile->current->data, actual_last_column(leftedge, target_column)); - if (openfile->current == was_current && openfile->current_x == was_x) - openfile->current_x--; if (scroll_only) edit_scroll(UPWARD, 1); @@ -488,7 +484,6 @@ void do_up(bool scroll_only) /* should not change placewewant, so restore it. */ openfile->placewewant = leftedge + target_column; - } /* Move the cursor to next line or chunk. If scroll_only is TRUE, also