To: Jeff.Walker@AUTOZONE.COM Cc: vim-dev@vim.org In-Reply-To: <862567CA.00579A02.00@ALERO.AUTOZONE.COM> Subject: patch 5.4.23 (was: visual selection vs. X clipboard selection on vim5.4) Fcc: outbox From: Bram Moolenaar ------------ Jeff - > I ran into something that I would call interesting, but I don't know if its > a bug or just something I think should work differently. > > When I make a visual selection, it puts in into the X cut-buffer. Then I > make an X selection in another application (like xterm) and the visual > selection on gvim becomes bold and underlined to tell me that gvim has lost > ownership of the X cut-buffer. This is new to version 5.4 and I like it > very much. Then, I double click the bold and underlined area to reselect > it, because I want to paste it again. This is where the trouble is: it > doesn't make a new visual selection, it leaves it as bold and underlined > and it doesn't put it into the X cut-buffer; if I paste again in xterm, the > old X cut-buffer is pasted. If I click somewhere else on gvim, like the > next line, and then double click on the bold and underline section, it will > go back to the bold and underline and not put this into the X cut-buffer. > If I double click on a different word, and then double click on the word > that I am trying to select, it will reacquire the visual selection and > reacquire the X selection. > > Like I said, I don't know if this would be considered a bug, but > nonetheless, I don't like how this works. I would rather it just reselect > that word and put it into the X cut-buffer. Sounds like a problem I solved some time ago for "gv"... Yes, it's the same problem. Since the Visually selected text is exactly the same, the selection isn't owned again. Hmm, this also happens when just typing "v" (selecting only a single character). I'll fix it in the same way as for "gv". Patch 5.4.23 Problem: When a Visual selection is lost to another program, and then the same text is Visually selected again, the clipboard ownership wasn't regained. Solution: Set clipboard.vmode to NUL to force regaining the clipboard. Files: src/normal.c *** ../vim-5.4.22/src/normal.c Sat Jul 24 16:19:14 1999 --- src/normal.c Wed Aug 11 23:08:18 1999 *************** *** 2512,2517 **** --- 2512,2522 ---- VIsual_mode = 'V'; else if (mod_mask & MOD_MASK_4CLICK) VIsual_mode = Ctrl('V'); + #ifdef USE_CLIPBOARD + /* Make sure the clipboard gets updated. Needed because start and + * end may still be the same, and the selection needs to be owned */ + clipboard.vmode = NUL; + #endif } if (mod_mask & MOD_MASK_2CLICK) { *************** *** 4900,4905 **** --- 4905,4915 ---- #endif if (p_smd) redraw_cmdline = TRUE; /* show visual mode later */ + #ifdef USE_CLIPBOARD + /* Make sure the clipboard gets updated. Needed because start and + * end may still be the same, and the selection needs to be owned */ + clipboard.vmode = NUL; + #endif update_screenline(); /* start the inversion */ } *** ../vim-5.4.22/src/version.h Wed Aug 11 22:31:27 1999 --- src/version.h Wed Aug 11 23:14:35 1999 *************** *** 19,26 **** #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 22 ! #define VIM_VERSION_PATCHLEVEL_STR "22" /* * VIM_VERSION_NODOT is used for the runtime directory name. --- 19,26 ---- #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 23 ! #define VIM_VERSION_PATCHLEVEL_STR "23" /* * VIM_VERSION_NODOT is used for the runtime directory name. *************** *** 30,35 **** */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.22" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.22 (1999 Aug 11)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.22 (1999 Aug 11, compiled " --- 30,35 ---- */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.23" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.23 (1999 Aug 11)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.23 (1999 Aug 11, compiled " -- hundred-and-one symptoms of being an internet addict: 43. You tell the kids they can't use the computer because "Daddy's got work to do" and you don't even have a job. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /