tweaks: rename a symbol, to be more accurate, and reshuffle two lines

master
Benno Schulenberg 2020-03-29 14:10:50 +02:00
parent 0cc2104257
commit 7ebe44ac25
2 changed files with 5 additions and 5 deletions

View File

@ -627,7 +627,7 @@ enum
#define WAS_WHOLE_LINE (1<<2) #define WAS_WHOLE_LINE (1<<2)
#define INCLUDED_LAST_LINE (1<<3) #define INCLUDED_LAST_LINE (1<<3)
#define MARK_WAS_SET (1<<4) #define MARK_WAS_SET (1<<4)
#define WAS_MARKED_BACKWARDS (1<<5) #define CURSOR_WAS_AT_HEAD (1<<5)
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
/* The default number of columns from end of line where wrapping occurs. */ /* The default number of columns from end of line where wrapping occurs. */

View File

@ -475,7 +475,7 @@ void undo_cut(undostruct *u)
openfile->filebot->prev->data[0] == '\0') openfile->filebot->prev->data[0] == '\0')
remove_magicline(); remove_magicline();
if (u->xflags & WAS_MARKED_BACKWARDS) if (u->xflags & CURSOR_WAS_AT_HEAD)
goto_line_posx(u->head_lineno, u->head_x); goto_line_posx(u->head_lineno, u->head_x);
} }
@ -1012,19 +1012,19 @@ void add_undo(undo_type action, const char *message)
break; break;
#endif #endif
case CUT_TO_EOF: case CUT_TO_EOF:
u->xflags |= (INCLUDED_LAST_LINE | WAS_MARKED_BACKWARDS); u->xflags |= (INCLUDED_LAST_LINE | CURSOR_WAS_AT_HEAD);
break; break;
case ZAP: case ZAP:
case CUT: case CUT:
if (openfile->mark) { if (openfile->mark) {
u->xflags |= MARK_WAS_SET;
if (mark_is_before_cursor()){ if (mark_is_before_cursor()){
u->head_lineno = openfile->mark->lineno; u->head_lineno = openfile->mark->lineno;
u->head_x = openfile->mark_x; u->head_x = openfile->mark_x;
u->xflags |= MARK_WAS_SET;
} else { } else {
u->xflags |= WAS_MARKED_BACKWARDS;
u->tail_lineno = openfile->mark->lineno; u->tail_lineno = openfile->mark->lineno;
u->tail_x = openfile->mark_x; u->tail_x = openfile->mark_x;
u->xflags |= (MARK_WAS_SET | CURSOR_WAS_AT_HEAD);
} }
if (u->tail_lineno == openfile->filebot->lineno) if (u->tail_lineno == openfile->filebot->lineno)
u->xflags |= INCLUDED_LAST_LINE; u->xflags |= INCLUDED_LAST_LINE;