tweaks: rename another type, to also better fit the general pattern

master
Benno Schulenberg 2019-10-02 17:18:51 +02:00
parent cc4ce8d83b
commit 53b77cb4c6
3 changed files with 21 additions and 21 deletions

View File

@ -305,7 +305,7 @@ typedef struct undo_group {
struct undo_group *next; struct undo_group *next;
} undo_group; } undo_group;
typedef struct undo { typedef struct undostruct {
ssize_t lineno; ssize_t lineno;
undo_type type; undo_type type;
/* What type of undo this was. */ /* What type of undo this was. */
@ -327,9 +327,9 @@ typedef struct undo {
/* Mostly the line number of the current line; sometimes something else. */ /* Mostly the line number of the current line; sometimes something else. */
size_t mark_begin_x; size_t mark_begin_x;
/* The x position corresponding to the above line number. */ /* The x position corresponding to the above line number. */
struct undo *next; struct undostruct *next;
/* A pointer to the undo item of the preceding action. */ /* A pointer to the undo item of the preceding action. */
} undo; } undostruct;
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
#ifdef ENABLE_HISTORIES #ifdef ENABLE_HISTORIES
@ -383,11 +383,11 @@ typedef struct openfilestruct {
/* Whether it is a soft (with Shift) or a hard mark. */ /* Whether it is a soft (with Shift) or a hard mark. */
format_type fmt; format_type fmt;
/* The file's format -- Unix or DOS or Mac or mixed. */ /* The file's format -- Unix or DOS or Mac or mixed. */
undo *undotop; undostruct *undotop;
/* The top of the undo list. */ /* The top of the undo list. */
undo *current_undo; undostruct *current_undo;
/* The current (i.e. next) level of undo. */ /* The current (i.e. next) level of undo. */
undo *last_saved; undostruct *last_saved;
/* The undo item at which the file was last saved. */ /* The undo item at which the file was last saved. */
undo_type last_action; undo_type last_action;
/* The type of the last action the user performed. */ /* The type of the last action the user performed. */

View File

@ -522,7 +522,7 @@ void do_enter(void);
#ifndef NANO_TINY #ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal); RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command); bool execute_command(const char *command);
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep); void discard_until(const undostruct *thisitem, openfilestruct *thefile, bool keep);
void add_undo(undo_type action); void add_undo(undo_type action);
void update_multiline_undo(ssize_t lineno, char *indentation); void update_multiline_undo(ssize_t lineno, char *indentation);
void update_undo(undo_type action); void update_undo(undo_type action);

View File

@ -287,7 +287,7 @@ void do_unindent(void)
} }
/* Perform an undo or redo for an indent or unindent action. */ /* Perform an undo or redo for an indent or unindent action. */
void handle_indent_action(undo *u, bool undoing, bool add_indent) void handle_indent_action(undostruct *u, bool undoing, bool add_indent)
{ {
undo_group *group = u->grouping; undo_group *group = u->grouping;
linestruct *line = line_from_number(group->top_line); linestruct *line = line_from_number(group->top_line);
@ -444,7 +444,7 @@ void do_comment(void)
} }
/* Perform an undo or redo for a comment or uncomment action. */ /* Perform an undo or redo for a comment or uncomment action. */
void handle_comment_action(undo *u, bool undoing, bool add_comment) void handle_comment_action(undostruct *u, bool undoing, bool add_comment)
{ {
undo_group *group = u->grouping; undo_group *group = u->grouping;
@ -477,7 +477,7 @@ void handle_comment_action(undo *u, bool undoing, bool add_comment)
#define undo_paste redo_cut #define undo_paste redo_cut
/* Undo a cut, or redo an uncut. */ /* Undo a cut, or redo an uncut. */
void undo_cut(undo *u) void undo_cut(undostruct *u)
{ {
/* Get to where we need to uncut from. */ /* Get to where we need to uncut from. */
if (u->xflags & WAS_WHOLE_LINE) if (u->xflags & WAS_WHOLE_LINE)
@ -501,7 +501,7 @@ void undo_cut(undo *u)
} }
/* Redo a cut, or undo an uncut. */ /* Redo a cut, or undo an uncut. */
void redo_cut(undo *u) void redo_cut(undostruct *u)
{ {
linestruct *oldcutbuffer = cutbuffer; linestruct *oldcutbuffer = cutbuffer;
@ -525,7 +525,7 @@ void redo_cut(undo *u)
/* Undo the last thing(s) we did. */ /* Undo the last thing(s) we did. */
void do_undo(void) void do_undo(void)
{ {
undo *u = openfile->current_undo; undostruct *u = openfile->current_undo;
linestruct *f = NULL, *t = NULL; linestruct *f = NULL, *t = NULL;
linestruct *oldcutbuffer; linestruct *oldcutbuffer;
char *data, *undidmsg = NULL; char *data, *undidmsg = NULL;
@ -694,7 +694,7 @@ void do_redo(void)
{ {
linestruct *f = NULL, *shoveline; linestruct *f = NULL, *shoveline;
char *data, *redidmsg = NULL; char *data, *redidmsg = NULL;
undo *u = openfile->undotop; undostruct *u = openfile->undotop;
if (u == NULL || u == openfile->current_undo) { if (u == NULL || u == openfile->current_undo) {
statusbar(_("Nothing to redo")); statusbar(_("Nothing to redo"));
@ -1084,9 +1084,9 @@ bool execute_command(const char *command)
/* Discard undo items that are newer than the given one, or all if NULL. /* Discard undo items that are newer than the given one, or all if NULL.
* When keep is TRUE, do not touch the last_saved pointer. */ * When keep is TRUE, do not touch the last_saved pointer. */
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep) void discard_until(const undostruct *thisitem, openfilestruct *thefile, bool keep)
{ {
undo *dropit = thefile->undotop; undostruct *dropit = thefile->undotop;
undo_group *group; undo_group *group;
while (dropit != NULL && dropit != thisitem) { while (dropit != NULL && dropit != thisitem) {
@ -1106,7 +1106,7 @@ void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
} }
/* Adjust the pointer to the top of the undo stack. */ /* Adjust the pointer to the top of the undo stack. */
thefile->current_undo = (undo *)thisitem; thefile->current_undo = (undostruct *)thisitem;
/* Prevent a chain of editing actions from continuing. */ /* Prevent a chain of editing actions from continuing. */
thefile->last_action = OTHER; thefile->last_action = OTHER;
@ -1114,20 +1114,20 @@ void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep)
/* When requested, record that the undo stack was chopped, and /* When requested, record that the undo stack was chopped, and
* that thus there is no point at which the file was last saved. */ * that thus there is no point at which the file was last saved. */
if (!keep) if (!keep)
thefile->last_saved = (undo *)0xbeeb; thefile->last_saved = (undostruct *)0xbeeb;
} }
/* Add a new undo item of the given type to the top of the current pile. */ /* Add a new undo item of the given type to the top of the current pile. */
void add_undo(undo_type action) void add_undo(undo_type action)
{ {
undo *u = openfile->current_undo; undostruct *u = openfile->current_undo;
/* The thing we did previously. */ /* The thing we did previously. */
/* Blow away newer undo items if we add somewhere in the middle. */ /* Blow away newer undo items if we add somewhere in the middle. */
discard_until(u, openfile, TRUE); discard_until(u, openfile, TRUE);
/* Allocate and initialize a new undo item. */ /* Allocate and initialize a new undo item. */
u = (undo *) nmalloc(sizeof(undo)); u = (undostruct *) nmalloc(sizeof(undostruct));
u->type = action; u->type = action;
u->strdata = NULL; u->strdata = NULL;
u->cutbuffer = NULL; u->cutbuffer = NULL;
@ -1250,7 +1250,7 @@ void add_undo(undo_type action)
* added or removed is saved separately for each line in the undo item. */ * added or removed is saved separately for each line in the undo item. */
void update_multiline_undo(ssize_t lineno, char *indentation) void update_multiline_undo(ssize_t lineno, char *indentation)
{ {
undo *u = openfile->current_undo; undostruct *u = openfile->current_undo;
/* If there already is a group and the current line is contiguous with it, /* If there already is a group and the current line is contiguous with it,
* extend the group; otherwise, create a new group. */ * extend the group; otherwise, create a new group. */
@ -1284,7 +1284,7 @@ void update_multiline_undo(ssize_t lineno, char *indentation)
* cursor position after the given action. */ * cursor position after the given action. */
void update_undo(undo_type action) void update_undo(undo_type action)
{ {
undo *u = openfile->undotop; undostruct *u = openfile->undotop;
char *char_buf; char *char_buf;
int charlen; int charlen;