From 4a1835fd9387344eb916a922957adeff659242fd Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sat, 31 Oct 2015 19:03:53 +0000 Subject: [PATCH] Refreshing the mark's pointer only when it is on the same line as the cursor, and recalculating the mark's x coordinate only when the mark comes after it. Also correcting the recalculation in one case. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5384 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 6 ++++++ src/nano.c | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ef36b31..77cc02ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-10-31 Benno Schulenberg + * src/nano.c (copy_from_filestruct): When pasting while the mark is + on, the mark's pointer needs to be refreshed only when it is on the + same line as the cursor, and the mark's x coordinate only when the + mark is located after the cursor. This fixes Savannah bug #46347. + 2015-10-29 Benno Schulenberg * src/text.c (add_undo): Only skip adding an undo when the current action equals the last action. This condition is needed for when diff --git a/src/nano.c b/src/nano.c index bd249f3d..c88ce0b4 100644 --- a/src/nano.c +++ b/src/nano.c @@ -458,7 +458,7 @@ void copy_from_filestruct(filestruct *somebuffer) openfile->current_x = strlen(openfile->filebot->data); if (openfile->fileage == openfile->filebot) { #ifndef NANO_TINY - if (openfile->mark_set) { + if (openfile->mark_set && single_line) { openfile->mark_begin = openfile->current; if (!right_side_up) openfile->mark_begin_x += openfile->current_x; @@ -476,9 +476,8 @@ void copy_from_filestruct(filestruct *somebuffer) } else { if (single_line) { openfile->mark_begin = openfile->current; - openfile->mark_begin_x -= current_x_save; - } else - openfile->mark_begin_x -= openfile->current_x; + openfile->mark_begin_x += openfile->current_x - current_x_save; + } } } #endif