To: vim-dev@vim.org Subject: patch 5.5.028 (extra) Fcc: outbox From: Bram Moolenaar ------------ Patch 5.5.028 (extra) Problem: Win32 GUI: When a file is dropped on Win32 gvim while at the ":" prompt, the file is edited but the command line is actually still there, the cursor goes back to command line on the next command. (Krishna) Solution: When dropping a file or directory on gvim while at the ":" prompt, insert the name of the file/directory. Allows using the file/directory name for any Ex command. Files: src/gui_w32.c *** ../vim-5.5.27/src/gui_w32.c Sun Oct 17 15:00:38 1999 --- src/gui_w32.c Sun Oct 17 20:05:00 1999 *************** *** 653,659 **** update_curbuf(NOT_VALID); /* delete the inversion */ } ! fnames = (char_u **) alloc(cFiles * sizeof(char_u *)); for (i = 0; i < cFiles; ++i) { --- 665,671 ---- update_curbuf(NOT_VALID); /* delete the inversion */ } ! fnames = (char_u **)alloc(cFiles * sizeof(char_u *)); for (i = 0; i < cFiles; ++i) { *************** *** 666,707 **** fname = szFile; fnames[i] = vim_strsave(fname); } /* ! * Handle dropping a directory on Vim. ! * Change to that directory and don't open any file. */ ! if (cFiles == 1 && mch_isdir(fnames[0])) { ! if (mch_chdir(fnames[0]) == 0) { ! smsg((char_u *)":cd %s", fnames[0]); ! vim_free(fnames[0]); ! fnames[0] = NULL; ! redo_dirs = TRUE; } } ! ! DragFinish(hDrop); ! ! if (fnames[0] != NULL) { ! /* Shift held down, change to first file's directory */ ! if (GetKeyState(VK_SHIFT) & 0x8000) ! if (vim_chdirfile(fnames[0]) == 0) redo_dirs = TRUE; ! /* Handle the drop, :edit or :split to get to the file */ ! handle_drop(cFiles, fnames, ((GetKeyState(VK_CONTROL) & 0x8000) != 0)); ! } ! if (redo_dirs) ! shorten_fnames(TRUE); ! /* Update the screen display */ ! update_screen(NOT_VALID); ! setcursor(); ! out_flush(); /* SetActiveWindow() doesn't work here... */ (void)SetForegroundWindow(s_hwnd); --- 678,738 ---- fname = szFile; fnames[i] = vim_strsave(fname); } + DragFinish(hDrop); /* ! * When the cursor is at the command line, add the file names to the ! * command line, don't edit the files. */ ! if (State & CMDLINE) { ! for (i = 0; i < cFiles; ++i) { ! if (fnames[i] != NULL) ! { ! if (i > 0) ! add_to_input_buf(" ", 1); ! add_to_input_buf(fnames[i], STRLEN(fnames[i])); ! } } } ! else { ! /* ! * Handle dropping a directory on Vim. ! * Change to that directory and don't open any file. ! */ ! if (cFiles == 1 && mch_isdir(fnames[0])) ! { ! if (mch_chdir(fnames[0]) == 0) ! { ! smsg((char_u *)":cd %s", fnames[0]); ! vim_free(fnames[0]); ! fnames[0] = NULL; redo_dirs = TRUE; + } + } ! if (fnames[0] != NULL) ! { ! /* Shift held down, change to first file's directory */ ! if (GetKeyState(VK_SHIFT) & 0x8000) ! if (vim_chdirfile(fnames[0]) == 0) ! redo_dirs = TRUE; ! ! /* Handle the drop, :edit or :split to get to the file */ ! handle_drop(cFiles, fnames, ! ((GetKeyState(VK_CONTROL) & 0x8000) != 0)); ! } ! if (redo_dirs) ! shorten_fnames(TRUE); ! /* Update the screen display */ ! update_screen(NOT_VALID); ! setcursor(); ! out_flush(); ! } /* SetActiveWindow() doesn't work here... */ (void)SetForegroundWindow(s_hwnd); *** ../vim-5.5.27/src/version.c Sun Oct 17 17:18:13 1999 --- src/version.c Sun Oct 17 20:10:04 1999 *************** *** 420,420 **** --- 420,421 ---- { /* Add new patch number below this line */ + 28, -- LAUNCELOT: Isn't there a St. Aaaaarrrrrrggghhh's in Cornwall? ARTHUR: No, that's Saint Ives. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /