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.
This commit is contained in:
Benno Schulenberg 2020-03-05 15:07:16 +01:00
parent 9e182fde66
commit ac61254581
2 changed files with 3 additions and 3 deletions

View File

@ -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. */

View File

@ -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;
}