commit ac61254581009a961001926aa95732882965334c
parent 9e182fde66e8368f3cfe49b9f038947ffac7c037
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 5 Mar 2020 15:07:16 +0100
tweaks: invert the logic of a symbol, to make more sense
Giving a name to the uncommon case is more fitting.
It also avoids a negation and allows to elide a condition.
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/nano.h b/src/nano.h
@@ -630,7 +630,7 @@ enum
#define WAS_WHOLE_LINE (1<<2)
#define INCLUDED_LAST_LINE (1<<3)
#define MARK_WAS_SET (1<<4)
-#define WAS_MARKED_FORWARD (1<<5)
+#define WAS_MARKED_BACKWARDS (1<<5)
#endif /* !NANO_TINY */
/* The default number of columns from end of line where wrapping occurs. */
diff --git a/src/text.c b/src/text.c
@@ -479,7 +479,7 @@ void undo_cut(undostruct *u)
openfile->filebot->prev->data[0] == '\0')
remove_magicline();
- if (!(u->xflags & WAS_MARKED_FORWARD) && u->type != PASTE)
+ if (u->xflags & WAS_MARKED_BACKWARDS)
goto_line_posx(u->head_lineno, u->head_x);
}
@@ -1187,8 +1187,8 @@ void add_undo(undo_type action, const char *message)
openfile->mark_x < openfile->current_x)) {
u->head_lineno = openfile->mark->lineno;
u->head_x = openfile->mark_x;
- u->xflags |= WAS_MARKED_FORWARD;
} else {
+ u->xflags |= WAS_MARKED_BACKWARDS;
u->tail_lineno = openfile->mark->lineno;
u->tail_x = openfile->mark_x;
}