mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
mceditor: new APIs.
* (edit_arg_init): initialize edit_arg_t object. * (edit_arg_assign): Apply new values to edit_arg_t object members. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
54bdd0efbf
commit
e79e76b72b
@ -4135,10 +4135,7 @@ void
|
||||
edit_stack_init (void)
|
||||
{
|
||||
for (edit_stack_iterator = 0; edit_stack_iterator < MAX_HISTORY_MOVETO; edit_stack_iterator++)
|
||||
{
|
||||
edit_history_moveto[edit_stack_iterator].file_vpath = NULL;
|
||||
edit_history_moveto[edit_stack_iterator].line_number = -1;
|
||||
}
|
||||
edit_arg_init (&edit_history_moveto[edit_stack_iterator], NULL, -1);
|
||||
|
||||
edit_stack_iterator = 0;
|
||||
}
|
||||
@ -4206,6 +4203,38 @@ edit_arg_new (const char *file_name, long line_number)
|
||||
return edit_arg_vpath_new (vfs_path_from_str (file_name), line_number);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Initialize edit_arg_t object.
|
||||
*
|
||||
* @param arg edit_arg_t object
|
||||
* @param vpath vfs_path_t object
|
||||
* @param line line number
|
||||
*/
|
||||
|
||||
void
|
||||
edit_arg_init (edit_arg_t * arg, vfs_path_t * vpath, long line)
|
||||
{
|
||||
arg->file_vpath = (vfs_path_t *) vpath;
|
||||
arg->line_number = line;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Apply new values to edit_arg_t object members.
|
||||
*
|
||||
* @param arg edit_arg_t object
|
||||
* @param vpath vfs_path_t object
|
||||
* @param line line number
|
||||
*/
|
||||
|
||||
void
|
||||
edit_arg_assign (edit_arg_t * arg, vfs_path_t * vpath, long line)
|
||||
{
|
||||
vfs_path_free (arg->file_vpath, TRUE);
|
||||
edit_arg_init (arg, vpath, line);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/**
|
||||
* Free the edit_arg_t object.
|
||||
|
@ -83,6 +83,8 @@ gboolean edit_files (const GList * files);
|
||||
|
||||
edit_arg_t *edit_arg_vpath_new (vfs_path_t * file_vpath, long line_number);
|
||||
edit_arg_t *edit_arg_new (const char *file_name, long line_number);
|
||||
void edit_arg_init (edit_arg_t * arg, vfs_path_t * vpath, long line);
|
||||
void edit_arg_assign (edit_arg_t * arg, vfs_path_t * vpath, long line);
|
||||
void edit_arg_free (edit_arg_t * arg);
|
||||
|
||||
const char *edit_get_file_name (const WEdit * edit);
|
||||
|
@ -380,23 +380,20 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, GPtrArray
|
||||
|
||||
if (curr != NULL && do_moveto && edit_stack_iterator + 1 < MAX_HISTORY_MOVETO)
|
||||
{
|
||||
vfs_path_free (edit_history_moveto[edit_stack_iterator].file_vpath, TRUE);
|
||||
vfs_path_t *vpath;
|
||||
|
||||
/* Is file path absolute? Prepend with dir_vpath if necessary */
|
||||
if (edit->filename_vpath != NULL && edit->filename_vpath->relative
|
||||
&& edit->dir_vpath != NULL)
|
||||
edit_history_moveto[edit_stack_iterator].file_vpath =
|
||||
vfs_path_append_vpath_new (edit->dir_vpath, edit->filename_vpath, NULL);
|
||||
vpath = vfs_path_append_vpath_new (edit->dir_vpath, edit->filename_vpath, NULL);
|
||||
else
|
||||
edit_history_moveto[edit_stack_iterator].file_vpath =
|
||||
vfs_path_clone (edit->filename_vpath);
|
||||
vpath = vfs_path_clone (edit->filename_vpath);
|
||||
|
||||
edit_history_moveto[edit_stack_iterator].line_number = edit->start_line + edit->curs_row + 1;
|
||||
edit_arg_assign (&edit_history_moveto[edit_stack_iterator], vpath,
|
||||
edit->start_line + edit->curs_row + 1);
|
||||
edit_stack_iterator++;
|
||||
vfs_path_free (edit_history_moveto[edit_stack_iterator].file_vpath, TRUE);
|
||||
edit_history_moveto[edit_stack_iterator].file_vpath =
|
||||
vfs_path_from_str ((char *) curr_def->fullpath);
|
||||
edit_history_moveto[edit_stack_iterator].line_number = curr_def->line;
|
||||
edit_arg_assign (&edit_history_moveto[edit_stack_iterator],
|
||||
vfs_path_from_str ((char *) curr_def->fullpath), curr_def->line);
|
||||
edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].file_vpath,
|
||||
edit_history_moveto[edit_stack_iterator].line_number);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user