tweaks: remove a superfluous condition, in three places

When 'last_action' has a specific value, then necessarily there must
exist a corresponding current undo item.

(The condition is already absent in do_deletion(), for the BACK and DEL
undo items, and it works fine there.)
master
Benno Schulenberg 2019-05-03 12:14:49 +02:00
parent dfe87540c6
commit e0c5c589ad
2 changed files with 3 additions and 3 deletions

View File

@ -380,7 +380,7 @@ void do_cut_text_void(void)
/* Only add a new undo item when the current item is not a CUT or when
* the current cut is not contiguous with the previous cutting. */
if (openfile->last_action != CUT || openfile->current_undo == NULL ||
if (openfile->last_action != CUT ||
openfile->current_undo->mark_begin_lineno != openfile->current->lineno ||
!keep_cutbuffer)
add_undo(CUT);
@ -448,7 +448,7 @@ void zap_text(void)
/* Add a new undo item only when the current item is not a ZAP or when
* the current zap is not contiguous with the previous zapping. */
if (openfile->last_action != ZAP || openfile->current_undo == NULL ||
if (openfile->last_action != ZAP ||
openfile->current_undo->mark_begin_lineno != openfile->current->lineno ||
openfile->current_undo->xflags & (MARK_WAS_SET|WAS_MARKED_FORWARD))
add_undo(ZAP);

View File

@ -1832,7 +1832,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifndef NANO_TINY
/* Only add a new undo item when the current item is not an ADD or when
* the current typing is not contiguous with the previous typing. */
if (openfile->last_action != ADD || openfile->current_undo == NULL ||
if (openfile->last_action != ADD ||
openfile->current_undo->mark_begin_lineno != openfile->current->lineno ||
openfile->current_undo->mark_begin_x != openfile->current_x)
add_undo(ADD);