mceditor: drop edit_stack_type. Use edit_arg_t instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-02-23 13:39:01 +03:00
parent ac41da50ee
commit 54bdd0efbf
4 changed files with 21 additions and 27 deletions

View File

@ -109,12 +109,6 @@ typedef struct edit_search_options_t
gboolean all_codepages; gboolean all_codepages;
} edit_search_options_t; } edit_search_options_t;
typedef struct edit_stack_type
{
long line;
vfs_path_t *filename_vpath;
} edit_stack_type;
/*** global variables defined in .c file *********************************************************/ /*** global variables defined in .c file *********************************************************/
extern const char VERTICAL_MAGIC[5]; extern const char VERTICAL_MAGIC[5];
@ -124,7 +118,7 @@ extern gboolean enable_show_tabs_tws;
extern edit_search_options_t edit_search_options; extern edit_search_options_t edit_search_options;
extern unsigned int edit_stack_iterator; extern unsigned int edit_stack_iterator;
extern edit_stack_type edit_history_moveto[MAX_HISTORY_MOVETO]; extern edit_arg_t edit_history_moveto[MAX_HISTORY_MOVETO];
extern int max_undo; extern int max_undo;
extern gboolean auto_syntax; extern gboolean auto_syntax;

View File

@ -111,7 +111,7 @@ int max_undo = 32768;
gboolean enable_show_tabs_tws = TRUE; gboolean enable_show_tabs_tws = TRUE;
unsigned int edit_stack_iterator = 0; unsigned int edit_stack_iterator = 0;
edit_stack_type edit_history_moveto[MAX_HISTORY_MOVETO]; edit_arg_t edit_history_moveto[MAX_HISTORY_MOVETO];
/* magic sequence for say than block is vertical */ /* magic sequence for say than block is vertical */
const char VERTICAL_MAGIC[] = { '\1', '\1', '\1', '\1', '\n' }; const char VERTICAL_MAGIC[] = { '\1', '\1', '\1', '\1', '\n' };
@ -4136,8 +4136,8 @@ edit_stack_init (void)
{ {
for (edit_stack_iterator = 0; edit_stack_iterator < MAX_HISTORY_MOVETO; edit_stack_iterator++) for (edit_stack_iterator = 0; edit_stack_iterator < MAX_HISTORY_MOVETO; edit_stack_iterator++)
{ {
edit_history_moveto[edit_stack_iterator].filename_vpath = NULL; edit_history_moveto[edit_stack_iterator].file_vpath = NULL;
edit_history_moveto[edit_stack_iterator].line = -1; edit_history_moveto[edit_stack_iterator].line_number = -1;
} }
edit_stack_iterator = 0; edit_stack_iterator = 0;
@ -4149,7 +4149,7 @@ void
edit_stack_free (void) edit_stack_free (void)
{ {
for (edit_stack_iterator = 0; edit_stack_iterator < MAX_HISTORY_MOVETO; edit_stack_iterator++) for (edit_stack_iterator = 0; edit_stack_iterator < MAX_HISTORY_MOVETO; edit_stack_iterator++)
vfs_path_free (edit_history_moveto[edit_stack_iterator].filename_vpath, TRUE); vfs_path_free (edit_history_moveto[edit_stack_iterator].file_vpath, TRUE);
} }
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */

View File

@ -1977,13 +1977,13 @@ edit_load_forward_cmd (WEdit * edit)
if (edit_stack_iterator + 1 >= MAX_HISTORY_MOVETO) if (edit_stack_iterator + 1 >= MAX_HISTORY_MOVETO)
return FALSE; return FALSE;
if (edit_history_moveto[edit_stack_iterator + 1].line < 1) if (edit_history_moveto[edit_stack_iterator + 1].line_number < 1)
return FALSE; return FALSE;
edit_stack_iterator++; edit_stack_iterator++;
if (edit_history_moveto[edit_stack_iterator].filename_vpath != NULL) if (edit_history_moveto[edit_stack_iterator].file_vpath != NULL)
return edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].filename_vpath, return edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].file_vpath,
edit_history_moveto[edit_stack_iterator].line); edit_history_moveto[edit_stack_iterator].line_number);
return FALSE; return FALSE;
} }
@ -2008,9 +2008,9 @@ edit_load_back_cmd (WEdit * edit)
return FALSE; return FALSE;
edit_stack_iterator--; edit_stack_iterator--;
if (edit_history_moveto[edit_stack_iterator].filename_vpath != NULL) if (edit_history_moveto[edit_stack_iterator].file_vpath != NULL)
return edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].filename_vpath, return edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].file_vpath,
edit_history_moveto[edit_stack_iterator].line); edit_history_moveto[edit_stack_iterator].line_number);
return FALSE; return FALSE;
} }

View File

@ -380,25 +380,25 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, GPtrArray
if (curr != NULL && do_moveto && edit_stack_iterator + 1 < MAX_HISTORY_MOVETO) if (curr != NULL && do_moveto && edit_stack_iterator + 1 < MAX_HISTORY_MOVETO)
{ {
vfs_path_free (edit_history_moveto[edit_stack_iterator].filename_vpath, TRUE); vfs_path_free (edit_history_moveto[edit_stack_iterator].file_vpath, TRUE);
/* Is file path absolute? Prepend with dir_vpath if necessary */ /* Is file path absolute? Prepend with dir_vpath if necessary */
if (edit->filename_vpath != NULL && edit->filename_vpath->relative if (edit->filename_vpath != NULL && edit->filename_vpath->relative
&& edit->dir_vpath != NULL) && edit->dir_vpath != NULL)
edit_history_moveto[edit_stack_iterator].filename_vpath = edit_history_moveto[edit_stack_iterator].file_vpath =
vfs_path_append_vpath_new (edit->dir_vpath, edit->filename_vpath, NULL); vfs_path_append_vpath_new (edit->dir_vpath, edit->filename_vpath, NULL);
else else
edit_history_moveto[edit_stack_iterator].filename_vpath = edit_history_moveto[edit_stack_iterator].file_vpath =
vfs_path_clone (edit->filename_vpath); vfs_path_clone (edit->filename_vpath);
edit_history_moveto[edit_stack_iterator].line = edit->start_line + edit->curs_row + 1; edit_history_moveto[edit_stack_iterator].line_number = edit->start_line + edit->curs_row + 1;
edit_stack_iterator++; edit_stack_iterator++;
vfs_path_free (edit_history_moveto[edit_stack_iterator].filename_vpath, TRUE); vfs_path_free (edit_history_moveto[edit_stack_iterator].file_vpath, TRUE);
edit_history_moveto[edit_stack_iterator].filename_vpath = edit_history_moveto[edit_stack_iterator].file_vpath =
vfs_path_from_str ((char *) curr_def->fullpath); vfs_path_from_str ((char *) curr_def->fullpath);
edit_history_moveto[edit_stack_iterator].line = curr_def->line; edit_history_moveto[edit_stack_iterator].line_number = curr_def->line;
edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].filename_vpath, edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].file_vpath,
edit_history_moveto[edit_stack_iterator].line); edit_history_moveto[edit_stack_iterator].line_number);
} }
} }