From: Benno Schulenberg Date: Wed, 17 Jun 2015 11:18:20 +0000 (+0000) Subject: Renaming the parameter 'current_action' to 'action', X-Git-Tag: v2.4.2~23 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=86cbd959f665bab973b313e4001fd5d6db0cfb81;p=nano.git Renaming the parameter 'current_action' to 'action', in order to match the other functions. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5254 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 423994da..11431cda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ * src/text.c (do_undo): Adjust whitespace after the previous change. * src/text.c (add_undo): Elide an unneeded variable and correct two comments. And try to put the more frequent condition first. + * src/text.c (add_undo): Rename the parameter 'current_action' to + 'action', to match the other functions. 2015-06-14 Benno Schulenberg * src/winio.c (edit_draw): Add some debugging code to track which diff --git a/src/proto.h b/src/proto.h index ca571da1..a5586224 100644 --- a/src/proto.h +++ b/src/proto.h @@ -734,7 +734,7 @@ void new_magicline(void); void remove_magicline(void); void mark_order(const filestruct **top, size_t *top_x, const filestruct **bot, size_t *bot_x, bool *right_side_up); -void add_undo(undo_type current_action); +void add_undo(undo_type action); void update_undo(undo_type action); #endif size_t get_totsize(const filestruct *begin, const filestruct *end); diff --git a/src/text.c b/src/text.c index d151d904..bd87307b 100644 --- a/src/text.c +++ b/src/text.c @@ -871,7 +871,7 @@ bool execute_command(const char *command) } /* Add a new undo struct to the top of the current pile. */ -void add_undo(undo_type current_action) +void add_undo(undo_type action) { openfilestruct *fs = openfile; undo *u = fs->current_undo; @@ -880,11 +880,11 @@ void add_undo(undo_type current_action) /* When doing contiguous adds or contiguous cuts -- which means: with * no cursor movement in between -- don't add a new undo item. */ if (u && u->mark_begin_lineno == fs->current->lineno && - ((current_action == ADD && u->type == ADD && u->mark_begin_x == fs->current_x) || - (current_action == CUT && u->type == CUT && !u->mark_set && keeping_cutbuffer()))) + ((action == ADD && u->type == ADD && u->mark_begin_x == fs->current_x) || + (action == CUT && u->type == CUT && !u->mark_set && keeping_cutbuffer()))) return; /* When trying to delete the final newline, don't add an undo for it. */ - if (current_action == DEL && openfile->current->next == openfile->filebot && + if (action == DEL && openfile->current->next == openfile->filebot && openfile->current->data[openfile->current_x] == '\0' && openfile->current_x != 0 && !ISSET(NO_NEWLINES)) return; @@ -901,7 +901,7 @@ void add_undo(undo_type current_action) /* Allocate and initialize a new undo type. */ u = (undo *) nmalloc(sizeof(undo)); - u->type = current_action; + u->type = action; u->lineno = fs->current->lineno; u->begin = fs->current_x; #ifndef DISABLE_WRAPPING @@ -952,11 +952,11 @@ void add_undo(undo_type current_action) } u->strdata = mallocstrcpy(NULL, fs->current->next->data); } - current_action = u->type = JOIN; + action = u->type = JOIN; break; #ifndef DISABLE_WRAPPING case SPLIT_BEGIN: - current_action = fs->undotop->type; + action = fs->undotop->type; break; case SPLIT_END: break; @@ -1004,10 +1004,10 @@ void add_undo(undo_type current_action) #ifdef DEBUG fprintf(stderr, "fs->current->data = \"%s\", current_x = %lu, u->begin = %lu, type = %d\n", - fs->current->data, (unsigned long)fs->current_x, (unsigned long)u->begin, current_action); + fs->current->data, (unsigned long)fs->current_x, (unsigned long)u->begin, action); fprintf(stderr, "left add_undo...\n"); #endif - fs->last_action = current_action; + fs->last_action = action; } /* Update an undo item, or determine whether a new one is really needed