comparison src/gui.c @ 26234:92bad8cd95d5 v8.2.3648

patch 8.2.3648: "verbose pwd" is incorrect after dropping files on Vim Commit: https://github.com/vim/vim/commit/4671e88d7d3ed12206d9cdd8892fe3b2cbc0d6ab Author: Bram Moolenaar <Bram@vim.org> Date: Mon Nov 22 17:21:48 2021 +0000 patch 8.2.3648: "verbose pwd" is incorrect after dropping files on Vim Problem: "verbose pwd" is incorrect after dropping files on Vim. Solution: Set the chdir reason to "drop".
author Bram Moolenaar <Bram@vim.org>
date Mon, 22 Nov 2021 18:30:05 +0100
parents 393ee487cf82
children 39f841f187d5
comparison
equal deleted inserted replaced
26233:f1f2bf26c81e 26234:92bad8cd95d5
5523 */ 5523 */
5524 static void 5524 static void
5525 drop_callback(void *cookie) 5525 drop_callback(void *cookie)
5526 { 5526 {
5527 char_u *p = cookie; 5527 char_u *p = cookie;
5528 int do_shorten = FALSE;
5528 5529
5529 // If Shift held down, change to first file's directory. If the first 5530 // If Shift held down, change to first file's directory. If the first
5530 // item is a directory, change to that directory (and let the explorer 5531 // item is a directory, change to that directory (and let the explorer
5531 // plugin show the contents). 5532 // plugin show the contents).
5532 if (p != NULL) 5533 if (p != NULL)
5533 { 5534 {
5534 if (mch_isdir(p)) 5535 if (mch_isdir(p))
5535 { 5536 {
5536 if (mch_chdir((char *)p) == 0) 5537 if (mch_chdir((char *)p) == 0)
5537 shorten_fnames(TRUE); 5538 do_shorten = TRUE;
5538 } 5539 }
5539 else if (vim_chdirfile(p, "drop") == OK) 5540 else if (vim_chdirfile(p, "drop") == OK)
5541 do_shorten = TRUE;
5542 vim_free(p);
5543 if (do_shorten)
5544 {
5540 shorten_fnames(TRUE); 5545 shorten_fnames(TRUE);
5541 vim_free(p); 5546 last_chdir_reason = "drop";
5547 }
5542 } 5548 }
5543 5549
5544 // Update the screen display 5550 // Update the screen display
5545 update_screen(NOT_VALID); 5551 update_screen(NOT_VALID);
5546 # ifdef FEAT_MENU 5552 # ifdef FEAT_MENU
5633 vim_free(fnames); 5639 vim_free(fnames);
5634 vim_free(p); 5640 vim_free(p);
5635 } 5641 }
5636 else 5642 else
5637 handle_drop(count, fnames, (modifiers & MOUSE_CTRL) != 0, 5643 handle_drop(count, fnames, (modifiers & MOUSE_CTRL) != 0,
5638 drop_callback, (void *)p); 5644 drop_callback, (void *)p);
5639 } 5645 }
5640 5646
5641 entered = FALSE; 5647 entered = FALSE;
5642 } 5648 }
5643 #endif 5649 #endif