mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-23 19:52:12 +03:00
(edit_insert_file_cmd): sync with new edit_insert_file()
...and make minor optimization.
(cherry picked from commit 8fae57a1f5
)
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
7e8fee6486
commit
402ad8519d
@ -241,7 +241,7 @@ void edit_complete_word_cmd (WEdit * edit);
|
||||
void edit_get_match_keyword_cmd (WEdit * edit);
|
||||
int edit_save_block (WEdit * edit, const char *filename, long start, long finish);
|
||||
int edit_save_block_cmd (WEdit * edit);
|
||||
int edit_insert_file_cmd (WEdit * edit);
|
||||
gboolean edit_insert_file_cmd (WEdit * edit);
|
||||
void edit_insert_over (WEdit * edit);
|
||||
int edit_insert_column_of_text_from_file (WEdit * edit, int file,
|
||||
long *start_pos, long *end_pos, int *col1, int *col2);
|
||||
|
@ -2778,43 +2778,33 @@ edit_save_block_cmd (WEdit * edit)
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/** returns 1 on success */
|
||||
/** returns TRUE on success */
|
||||
|
||||
int
|
||||
gboolean
|
||||
edit_insert_file_cmd (WEdit * edit)
|
||||
{
|
||||
gchar *tmp;
|
||||
char *exp;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
tmp = mc_config_get_full_path (EDIT_CLIP_FILE);
|
||||
exp = input_expand_dialog (_("Insert file"), _("Enter file name:"),
|
||||
MC_HISTORY_EDIT_INSERT_FILE, tmp);
|
||||
g_free (tmp);
|
||||
|
||||
edit_push_undo_action (edit, KEY_PRESS + edit->start_display);
|
||||
if (exp)
|
||||
|
||||
if (exp != NULL && *exp != '\0')
|
||||
{
|
||||
if (!*exp)
|
||||
{
|
||||
g_free (exp);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (edit_insert_file (edit, exp) != 0)
|
||||
{
|
||||
g_free (exp);
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (exp);
|
||||
edit_error_dialog (_("Insert file"), get_sys_error (_("Cannot insert file")));
|
||||
}
|
||||
}
|
||||
ret = (edit_insert_file (edit, exp) >= 0);
|
||||
if (!ret)
|
||||
edit_error_dialog (_("Insert file"), get_sys_error (_("Cannot insert file")));
|
||||
}
|
||||
|
||||
g_free (exp);
|
||||
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user