tweaks: rename two symbols, to be more precise

master
Benno Schulenberg 2020-03-02 17:13:10 +01:00
parent 477a9b33b4
commit 89217f20af
2 changed files with 15 additions and 15 deletions

View File

@ -626,9 +626,9 @@ enum
#define KEY_WINCH -2 #define KEY_WINCH -2
/* Some extra flags for the undo function. */ /* Some extra flags for the undo function. */
#define WAS_FINAL_BACKSPACE (1<<1) #define WAS_BACKSPACE_AT_EOF (1<<1)
#define WAS_WHOLE_LINE (1<<2) #define WAS_WHOLE_LINE (1<<2)
#define WAS_FINAL_LINE (1<<3) #define INCLUDED_LAST_LINE (1<<3)
#define MARK_WAS_SET (1<<4) #define MARK_WAS_SET (1<<4)
#define WAS_MARKED_FORWARD (1<<5) #define WAS_MARKED_FORWARD (1<<5)
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */

View File

@ -474,7 +474,7 @@ void undo_cut(undostruct *u)
copy_from_buffer(u->cutbuffer); copy_from_buffer(u->cutbuffer);
/* If originally the last line was cut too, remove an extra magic line. */ /* If originally the last line was cut too, remove an extra magic line. */
if ((u->xflags & WAS_FINAL_LINE) && !ISSET(NO_NEWLINES) && if ((u->xflags & INCLUDED_LAST_LINE) && !ISSET(NO_NEWLINES) &&
openfile->filebot != openfile->current && openfile->filebot != openfile->current &&
openfile->filebot->prev->data[0] == '\0') openfile->filebot->prev->data[0] == '\0')
remove_magicline(); remove_magicline();
@ -522,7 +522,7 @@ void do_undo(void)
/* TRANSLATORS: The next thirteen strings describe actions /* TRANSLATORS: The next thirteen strings describe actions
* that are undone or redone. They are all nouns, not verbs. */ * that are undone or redone. They are all nouns, not verbs. */
undidmsg = _("addition"); undidmsg = _("addition");
if ((u->xflags & WAS_FINAL_LINE) && !ISSET(NO_NEWLINES)) if ((u->xflags & INCLUDED_LAST_LINE) && !ISSET(NO_NEWLINES))
remove_magicline(); remove_magicline();
memmove(line->data + u->head_x, line->data + u->head_x + strlen(u->strdata), memmove(line->data + u->head_x, line->data + u->head_x + strlen(u->strdata),
strlen(line->data + u->head_x) - strlen(u->strdata) + 1); strlen(line->data + u->head_x) - strlen(u->strdata) + 1);
@ -553,7 +553,7 @@ void do_undo(void)
/* When the join was done by a Backspace at the tail of the file, /* When the join was done by a Backspace at the tail of the file,
* and the nonewlines flag isn't set, do not re-add a newline that * and the nonewlines flag isn't set, do not re-add a newline that
* wasn't actually deleted; just position the cursor. */ * wasn't actually deleted; just position the cursor. */
if ((u->xflags & WAS_FINAL_BACKSPACE) && !ISSET(NO_NEWLINES)) { if ((u->xflags & WAS_BACKSPACE_AT_EOF) && !ISSET(NO_NEWLINES)) {
goto_line_posx(openfile->filebot->lineno, 0); goto_line_posx(openfile->filebot->lineno, 0);
break; break;
} }
@ -595,7 +595,7 @@ void do_undo(void)
case PASTE: case PASTE:
undidmsg = _("paste"); undidmsg = _("paste");
undo_paste(u); undo_paste(u);
if ((u->xflags & WAS_FINAL_LINE) && !ISSET(NO_NEWLINES) && if ((u->xflags & INCLUDED_LAST_LINE) && !ISSET(NO_NEWLINES) &&
openfile->filebot != openfile->current) openfile->filebot != openfile->current)
remove_magicline(); remove_magicline();
break; break;
@ -609,7 +609,7 @@ void do_undo(void)
cut_marked(NULL); cut_marked(NULL);
u->cutbuffer = cutbuffer; u->cutbuffer = cutbuffer;
cutbuffer = oldcutbuffer; cutbuffer = oldcutbuffer;
if ((u->xflags & WAS_FINAL_LINE) && !ISSET(NO_NEWLINES) && if ((u->xflags & INCLUDED_LAST_LINE) && !ISSET(NO_NEWLINES) &&
openfile->filebot != openfile->current) openfile->filebot != openfile->current)
remove_magicline(); remove_magicline();
break; break;
@ -688,7 +688,7 @@ void do_redo(void)
switch (u->type) { switch (u->type) {
case ADD: case ADD:
redidmsg = _("addition"); redidmsg = _("addition");
if ((u->xflags & WAS_FINAL_LINE) && !ISSET(NO_NEWLINES)) if ((u->xflags & INCLUDED_LAST_LINE) && !ISSET(NO_NEWLINES))
new_magicline(); new_magicline();
data = charalloc(strlen(line->data) + strlen(u->strdata) + 1); data = charalloc(strlen(line->data) + strlen(u->strdata) + 1);
strncpy(data, line->data, u->head_x); strncpy(data, line->data, u->head_x);
@ -719,7 +719,7 @@ void do_redo(void)
/* When the join was done by a Backspace at the tail of the file, /* When the join was done by a Backspace at the tail of the file,
* and the nonewlines flag isn't set, do not join anything, as * and the nonewlines flag isn't set, do not join anything, as
* nothing was actually deleted; just position the cursor. */ * nothing was actually deleted; just position the cursor. */
if ((u->xflags & WAS_FINAL_BACKSPACE) && !ISSET(NO_NEWLINES)) { if ((u->xflags & WAS_BACKSPACE_AT_EOF) && !ISSET(NO_NEWLINES)) {
goto_line_posx(u->tail_lineno, u->tail_x); goto_line_posx(u->tail_lineno, u->tail_x);
break; break;
} }
@ -1131,7 +1131,7 @@ void add_undo(undo_type action, const char *message)
case ADD: case ADD:
/* If a new magic line will be added, an undo should remove it. */ /* If a new magic line will be added, an undo should remove it. */
if (openfile->current == openfile->filebot) if (openfile->current == openfile->filebot)
u->xflags |= WAS_FINAL_LINE; u->xflags |= INCLUDED_LAST_LINE;
break; break;
case ENTER: case ENTER:
break; break;
@ -1140,7 +1140,7 @@ void add_undo(undo_type action, const char *message)
* backspace, as it won't actually have deleted anything. */ * backspace, as it won't actually have deleted anything. */
if (openfile->current->next == openfile->filebot && if (openfile->current->next == openfile->filebot &&
openfile->current->data[0] != '\0') openfile->current->data[0] != '\0')
u->xflags |= WAS_FINAL_BACKSPACE; u->xflags |= WAS_BACKSPACE_AT_EOF;
/* Fall-through. */ /* Fall-through. */
case DEL: case DEL:
/* When not at the end of a line, store the deleted character; /* When not at the end of a line, store the deleted character;
@ -1173,7 +1173,7 @@ void add_undo(undo_type action, const char *message)
break; break;
#endif #endif
case CUT_TO_EOF: case CUT_TO_EOF:
u->xflags |= WAS_FINAL_LINE; u->xflags |= INCLUDED_LAST_LINE;
break; break;
case ZAP: case ZAP:
case CUT: case CUT:
@ -1191,7 +1191,7 @@ void add_undo(undo_type action, const char *message)
} }
if (openfile->current == openfile->filebot || if (openfile->current == openfile->filebot ||
openfile->mark == openfile->filebot) openfile->mark == openfile->filebot)
u->xflags |= WAS_FINAL_LINE; u->xflags |= INCLUDED_LAST_LINE;
} else if (!ISSET(CUT_FROM_CURSOR)) { } else if (!ISSET(CUT_FROM_CURSOR)) {
/* The entire line is being cut regardless of the cursor position. */ /* The entire line is being cut regardless of the cursor position. */
u->head_x = 0; u->head_x = 0;
@ -1202,11 +1202,11 @@ void add_undo(undo_type action, const char *message)
u->cutbuffer = copy_buffer(cutbuffer); u->cutbuffer = copy_buffer(cutbuffer);
u->head_lineno += cutbottom->lineno - cutbuffer->lineno; u->head_lineno += cutbottom->lineno - cutbuffer->lineno;
if (openfile->current == openfile->filebot) if (openfile->current == openfile->filebot)
u->xflags |= WAS_FINAL_LINE; u->xflags |= INCLUDED_LAST_LINE;
break; break;
case INSERT: case INSERT:
if (openfile->current == openfile->filebot) if (openfile->current == openfile->filebot)
u->xflags |= WAS_FINAL_LINE; u->xflags |= INCLUDED_LAST_LINE;
break; break;
case COUPLE_BEGIN: case COUPLE_BEGIN:
u->tail_lineno = openfile->current_y; u->tail_lineno = openfile->current_y;