diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-07-29 17:35:23 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-07-29 17:35:23 +0200 |
commit | 92d147be959e689f8f58fd5d138a31835e160289 (patch) | |
tree | 5ba25e99d246153860ba91d9fc7629b67801d993 /src/gui.c | |
parent | fda95e75721fb221495c69e493ec2761b5d85123 (diff) | |
download | vim-git-92d147be959e689f8f58fd5d138a31835e160289.tar.gz |
patch 8.1.0228: dropping files is ignored while Vim is busyv8.1.0228
Problem: Dropping files is ignored while Vim is busy.
Solution: Postpone the effect of dropping files until it's safe.
Diffstat (limited to 'src/gui.c')
-rw-r--r-- | src/gui.c | 70 |
1 files changed, 39 insertions, 31 deletions
@@ -5383,10 +5383,7 @@ gui_do_findrepl( #endif -#if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \ - || defined(FEAT_GUI_MSWIN) \ - || defined(FEAT_GUI_MAC) \ - || defined(PROTO) +#if defined(HAVE_DROP_FILE) || defined(PROTO) static void gui_wingoto_xy(int x, int y); @@ -5409,6 +5406,42 @@ gui_wingoto_xy(int x, int y) } /* + * Function passed to handle_drop() for the actions to be done after the + * argument list has been updated. + */ + static void +drop_callback(void *cookie) +{ + char_u *p = cookie; + + /* If Shift held down, change to first file's directory. If the first + * item is a directory, change to that directory (and let the explorer + * plugin show the contents). */ + if (p != NULL) + { + if (mch_isdir(p)) + { + if (mch_chdir((char *)p) == 0) + shorten_fnames(TRUE); + } + else if (vim_chdirfile(p, "drop") == OK) + shorten_fnames(TRUE); + vim_free(p); + } + + /* Update the screen display */ + update_screen(NOT_VALID); +# ifdef FEAT_MENU + gui_update_menus(0); +# endif +#ifdef FEAT_TITLE + maketitle(); +#endif + setcursor(); + out_flush_cursor(FALSE, FALSE); +} + +/* * Process file drop. Mouse cursor position, key modifiers, name of files * and count of files are given. Argument "fnames[count]" has full pathnames * of dropped files, they will be freed in this function, and caller can't use @@ -5488,33 +5521,8 @@ gui_handle_drop( vim_free(fnames); } else - handle_drop(count, fnames, (modifiers & MOUSE_CTRL) != 0); - - /* If Shift held down, change to first file's directory. If the first - * item is a directory, change to that directory (and let the explorer - * plugin show the contents). */ - if (p != NULL) - { - if (mch_isdir(p)) - { - if (mch_chdir((char *)p) == 0) - shorten_fnames(TRUE); - } - else if (vim_chdirfile(p, "drop") == OK) - shorten_fnames(TRUE); - vim_free(p); - } - - /* Update the screen display */ - update_screen(NOT_VALID); -# ifdef FEAT_MENU - gui_update_menus(0); -# endif -#ifdef FEAT_TITLE - maketitle(); -#endif - setcursor(); - out_flush_cursor(FALSE, FALSE); + handle_drop(count, fnames, (modifiers & MOUSE_CTRL) != 0, + drop_callback, (void *)p); } entered = FALSE; |