diff --git a/src/nano.c b/src/nano.c
index ebff96759dbe17018bdf8ba7f84d3bedd2fc5dfb..4f61459705bff32881b3176f2f0aaf82fe2e59ea 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1762,9 +1762,12 @@ int do_input(bool allow_funcs)
 			/* When the marked region changes without Shift being held,
 			 * discard a soft mark.  And when the marked region covers a
 			 * different set of lines, reset  the "last line too" flag. */
-			if (openfile->mark && (openfile->current != was_current ||
-										openfile->current_x != was_x)) {
-				if (!shift_held && openfile->kind_of_mark == SOFTMARK) {
+			if (openfile->mark) {
+				if (!shift_held && openfile->kind_of_mark == SOFTMARK &&
+									(openfile->current != was_current ||
+									openfile->current_x != was_x ||
+									(shortcut->func >= to_first_line &&
+									shortcut->func <= do_right))) {
 					openfile->mark = NULL;
 					refresh_needed = TRUE;
 				} else if (openfile->current != was_current)