To: vim-dev@vim.org Subject: Patch 6.1.440 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.440 Problem: The "@*" command doesn't obtain the actual contents of the clipboard. (Hari Krishna Dara) Solution: Obtain the clipboard text before executing the command. Files: src/ops.c *** ../vim61.439/src/ops.c Sun Mar 23 21:06:00 2003 --- src/ops.c Thu Apr 3 22:05:00 2003 *************** *** 1036,1041 **** --- 1036,1070 ---- return OK; } + #ifdef FEAT_CLIPBOARD + /* + * When "regname" is a clipboard register, obtain the selection. If it's not + * available return zero, otherwise return "regname". + */ + static int may_get_selection __ARGS((int regname)); + + static int + may_get_selection(regname) + int regname; + { + if (regname == '*') + { + if (!clip_star.available) + regname = 0; + else + clip_get_selection(&clip_star); + } + else if (regname == '+') + { + if (!clip_plus.available) + regname = 0; + else + clip_get_selection(&clip_plus); + } + return regname; + } + #endif + /* * execute a yank register: copy it into the stuff buffer * *************** *** 1060,1065 **** --- 1089,1098 ---- return FAIL; lastc = regname; + #ifdef FEAT_CLIPBOARD + regname = may_get_selection(regname); + #endif + if (regname == '_') /* black hole: don't stuff anything */ return OK; *************** *** 1176,1195 **** return FAIL; #ifdef FEAT_CLIPBOARD ! if (regname == '*') ! { ! if (!clip_star.available) ! regname = 0; ! else ! clip_get_selection(&clip_star); ! } ! else if (regname == '+') ! { ! if (!clip_plus.available) ! regname = 0; ! else ! clip_get_selection(&clip_plus); ! } #endif if (regname == '.') /* insert last inserted text */ --- 1209,1215 ---- return FAIL; #ifdef FEAT_CLIPBOARD ! regname = may_get_selection(regname); #endif if (regname == '.') /* insert last inserted text */ *************** *** 1380,1399 **** return FAIL; #ifdef FEAT_CLIPBOARD ! if (regname == '*') ! { ! if (!clip_star.available) ! regname = 0; ! else ! clip_get_selection(&clip_star); ! } ! else if (regname == '+') ! { ! if (!clip_plus.available) ! regname = 0; ! else ! clip_get_selection(&clip_plus); ! } #endif if (get_spec_reg(regname, &arg, &allocated, TRUE)) --- 1400,1406 ---- return FAIL; #ifdef FEAT_CLIPBOARD ! regname = may_get_selection(regname); #endif if (get_spec_reg(regname, &arg, &allocated, TRUE)) *************** *** 2951,2960 **** #ifdef FEAT_CLIPBOARD /* Adjust register name for "unnamed" in 'clipboard'. */ adjust_clip_reg(®name); ! if (regname == '*') ! clip_get_selection(&clip_star); ! else if (regname == '+') ! clip_get_selection(&clip_plus); #endif if (flags & PUT_FIXINDENT) --- 2958,2964 ---- #ifdef FEAT_CLIPBOARD /* Adjust register name for "unnamed" in 'clipboard'. */ adjust_clip_reg(®name); ! (void)may_get_selection(regname); #endif if (flags & PUT_FIXINDENT) *************** *** 5283,5302 **** return NULL; #ifdef FEAT_CLIPBOARD ! if (regname == '*') ! { ! if (!clip_star.available) ! regname = 0; ! else ! clip_get_selection(&clip_star); /* may fill * register */ ! } ! else if (regname == '+') ! { ! if (!clip_plus.available) ! regname = 0; ! else ! clip_get_selection(&clip_plus); /* may fill + register */ ! } #endif if (get_spec_reg(regname, &retval, &allocated, FALSE)) --- 5287,5293 ---- return NULL; #ifdef FEAT_CLIPBOARD ! regname = may_get_selection(regname); #endif if (get_spec_reg(regname, &retval, &allocated, FALSE)) *** ../vim61.439/src/version.c Sun Apr 6 14:41:10 2003 --- src/version.c Sun Apr 6 14:42:34 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 440, /**/ -- Q: What do you call a fish without an eye? A: fsh! Q: What do you call a deer with no eyes? A: no eye deer. Q: What do you call a deer with no eyes and no legs? A: still no eye deer. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///