Ticket #2993: mc.2993_paste_src_filename.diff

File mc.2993_paste_src_filename.diff, 5.0 KB (added by szaszg, 7 years ago)
  • lib/keybind.c

    diff --git a/lib/keybind.c b/lib/keybind.c
    index eedea6b..dabd5c8 100644
    a b static name_keymap_t command_names[] = { 
    134134    {"Bookmark", CK_Bookmark}, 
    135135    {"Quit", CK_Quit}, 
    136136    {"QuitQuiet", CK_QuitQuiet}, 
     137    {"PasteSrcFilename", CK_PasteSrcFilename}, 
    137138    {"ExtendedKeyMap", CK_ExtendedKeyMap}, 
    138139 
    139140    /* main commands */ 
  • lib/keybind.h

    diff --git a/lib/keybind.h b/lib/keybind.h
    index 5bfb81b..c6b7f6e 100644
    a b enum 
    124124    CK_Bookmark, 
    125125    CK_Quit, 
    126126    CK_QuitQuiet, 
     127    CK_PasteSrcFilename, 
    127128    /* C-x or similar */ 
    128129    CK_ExtendedKeyMap, 
    129130 
  • misc/mc.default.keymap

    diff --git a/misc/mc.default.keymap b/misc/mc.default.keymap
    index 9d1bb60..13796dd 100644
    a b Select = kpplus 
    3737Unselect = kpminus 
    3838SelectInvert = kpasterisk 
    3939ScreenList = alt-prime 
     40PasteSrcFilename = ctrl-v; ctrl-insert 
    4041# OptionsLayout = 
    4142# OptionsPanel = 
    4243# OptionsConfirm = 
  • misc/mc.emacs.keymap

    diff --git a/misc/mc.emacs.keymap b/misc/mc.emacs.keymap
    index 6d503b4..72de2ab 100644
    a b Select = kpplus 
    3737Unselect = kpminus 
    3838SelectInvert = kpasterisk 
    3939ScreenList = alt-prime 
     40PasteSrcFilename = ctrl-v; ctrl-insert 
    4041# OptionsLayout = 
    4142# OptionsPanel = 
    4243# OptionsConfirm = 
  • src/filemanager/filegui.c

    diff --git a/src/filemanager/filegui.c b/src/filemanager/filegui.c
    index 009b2e7..a5af1ca 100644
    a b statfs (char const *filename, struct fs_info *buf) 
    180180#include "lib/widget.h" 
    181181 
    182182#include "src/setup.h"          /* verbose */ 
     183#include "src/keybind-defaults.h" 
    183184 
    184185#include "midnight.h" 
    185186#include "fileopctx.h"          /* FILE_CONT */ 
    struct 
    277278    /* *INDENT-ON* */ 
    278279}; 
    279280 
     281static unsigned long file_mask_dst_id; 
     282static const char *file_mask_src_filename; 
     283 
    280284/* --------------------------------------------------------------------------------------------- */ 
    281285/*** file scope functions ************************************************************************/ 
    282286/* --------------------------------------------------------------------------------------------- */ 
    progress_button_callback (WButton * button, int action) 
    646650} 
    647651 
    648652/* --------------------------------------------------------------------------------------------- */ 
     653 
     654static cb_ret_t 
     655file_mask_dialog_cb (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) 
     656{ 
     657    switch (msg) 
     658    { 
     659    case MSG_KEY: 
     660        { 
     661            cb_ret_t ret = MSG_NOT_HANDLED; 
     662 
     663            if (keybind_lookup_keymap_command (main_map, parm) == CK_PasteSrcFilename) 
     664            { 
     665                WInput *wi; 
     666                wi = INPUT(dlg_find_by_id (DIALOG (w), file_mask_dst_id)); 
     667                input_insert (wi, file_mask_src_filename, FALSE); 
     668                ret = MSG_HANDLED; 
     669            } 
     670 
     671            return ret; 
     672        } 
     673 
     674    default: 
     675        return dlg_default_callback (w, sender, msg, parm, data); 
     676    } 
     677} 
     678 
     679/* --------------------------------------------------------------------------------------------- */ 
    649680/*** public functions ****************************************************************************/ 
    650681/* --------------------------------------------------------------------------------------------- */ 
    651682 
    file_mask_dialog (FileOpContext * ctx, FileOperation operation, 
    11581189        int format_len, text_len; 
    11591190        int max_len; 
    11601191 
     1192        file_mask_src_filename = text; 
     1193 
    11611194        format_len = str_term_width1 (format); 
    11621195        text_len = str_term_width1 (text); 
    11631196        max_len = COLS - 2 - 6; 
    file_mask_dialog (FileOpContext * ctx, FileOperation operation, 
    11981231                QUICK_CHECKBOX (N_("&Using shell patterns"), &source_easy_patterns, NULL), 
    11991232            QUICK_STOP_COLUMNS, 
    12001233            QUICK_LABELED_INPUT (N_("to:"), input_label_above, 
    1201                                  def_text_secure, "input2", &dest_dir, NULL, FALSE, FALSE, INPUT_COMPLETE_FILENAMES), 
     1234                                 def_text_secure, "input2", &dest_dir, &file_mask_dst_id, FALSE, FALSE, INPUT_COMPLETE_FILENAMES), 
    12021235            QUICK_SEPARATOR (TRUE), 
    12031236            QUICK_START_COLUMNS, 
    12041237                QUICK_CHECKBOX (N_("Follow &links"), &ctx->follow_links, NULL), 
    file_mask_dialog (FileOpContext * ctx, FileOperation operation, 
    12201253        quick_dialog_t qdlg = { 
    12211254            -1, -1, fmd_xlen, 
    12221255            op_names[operation], "[Mask Copy/Rename]", 
    1223             quick_widgets, NULL, NULL 
     1256            quick_widgets, only_one ? file_mask_dialog_cb : NULL, NULL 
    12241257        }; 
    12251258 
    12261259      ask_file_mask: 
  • src/keybind-defaults.c

    diff --git a/src/keybind-defaults.c b/src/keybind-defaults.c
    index 7ad1f55..748c255 100644
    a b static const global_keymap_ini_t default_main_keymap[] = { 
    130130    {"SelectInvert", "kpasterisk"}, 
    131131    /* List of screens */ 
    132132    {"ScreenList", "alt-prime"}, 
     133    /* Paste Source filename on Copy/Move dialog */ 
     134    {"PasteSrcFilename", "ctrl-v; ctrl-insert"}, 
    133135    {NULL, NULL} 
    134136}; 
    135137