nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nano-devel] [PATCH] selecting: do not cancel the softmark when the curs


From: Benno Schulenberg
Subject: [Nano-devel] [PATCH] selecting: do not cancel the softmark when the cursor is not moved
Date: Sat, 25 Nov 2017 20:32:18 +0100

The softmark is only cancelled when the cursor is moved without Shift
being held.

This addresses https://savannah.gnu.org/bugs/?52470.
---
 src/nano.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/nano.c b/src/nano.c
index dc7f3740..554a9008 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1687,6 +1687,9 @@ int do_input(bool allow_funcs)
 #endif
        {
 #ifndef NANO_TINY
+           filestruct *was_current = openfile->current;
+           size_t was_x = openfile->current_x;
+
            /* If Shifted movement occurs, set the mark. */
            if (shift_held && !openfile->mark) {
                openfile->mark = openfile->current;
@@ -1699,6 +1702,8 @@ int do_input(bool allow_funcs)
 #ifndef NANO_TINY
            /* If Shiftless movement occurred, discard a soft mark. */
            if (!shift_held && openfile->mark &&
+                               (openfile->current_x != was_x ||
+                               openfile->current != was_current) &&
                                openfile->kind_of_mark == SOFTMARK) {
                openfile->mark = NULL;
                refresh_needed = TRUE;
-- 
2.14.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]