tweaks: rename a function, for contrast, and update antiquated comments

This commit is contained in:
Benno Schulenberg 2024-04-25 10:32:11 +02:00
parent d53521a631
commit 1327e296c2
1 changed files with 11 additions and 8 deletions

View File

@ -24,8 +24,9 @@
#include <string.h>
/* Delete the character under the cursor. */
void do_deletion(undo_type action)
/* Delete the character at the current position, and
* add or update an undo item for the given action. */
void expunge(undo_type action)
{
openfile->placewewant = xplustabs();
@ -112,7 +113,8 @@ void do_deletion(undo_type action)
set_modified();
}
/* Delete the character under the cursor. */
/* Delete the character under the cursor plus any succeeding zero-widths,
* or, when the mark is on and --zap is active, delete the marked region. */
void do_delete(void)
{
#ifndef NANO_TINY
@ -121,17 +123,18 @@ void do_delete(void)
else
#endif
{
do_deletion(DEL);
expunge(DEL);
#ifdef ENABLE_UTF8
while (openfile->current->data[openfile->current_x] != '\0' &&
is_zerowidth(openfile->current->data + openfile->current_x))
do_deletion(DEL);
expunge(DEL);
#endif
}
}
/* Backspace over one character. That is, move the cursor left one
* character, and then delete the character under the cursor. */
* character, and then delete the character under the cursor. Or,
* when mark is on and --zap is active, delete the marked region. */
void do_backspace(void)
{
#ifndef NANO_TINY
@ -141,10 +144,10 @@ void do_backspace(void)
#endif
if (openfile->current_x > 0) {
openfile->current_x = step_left(openfile->current->data, openfile->current_x);
do_deletion(BACK);
expunge(BACK);
} else if (openfile->current != openfile->filetop) {
do_left();
do_deletion(BACK);
expunge(BACK);
}
}