]> granicus.if.org Git - vim/commitdiff
patch 8.2.0907: when using :global clipboard isn't set correctly v8.2.0907
authorBram Moolenaar <Bram@vim.org>
Fri, 5 Jun 2020 18:03:16 +0000 (20:03 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 5 Jun 2020 18:03:16 +0000 (20:03 +0200)
Problem:    When using :global clipboard isn't set correctly.
Solution:   Set "clip_unnamed_saved" instead of "clip_unnamed". (Christian
            Brabandt, closes #6203, closes #6198)

src/clipboard.c
src/testdir/test_global.vim
src/version.c

index 7a35112d2557218eab63074c2b51c097bded6149..5db13a0d216c5579d52233033822366efae644f4 100644 (file)
@@ -1317,7 +1317,12 @@ check_clipboard_option(void)
     }
     if (errmsg == NULL)
     {
-       clip_unnamed = new_unnamed;
+       if (global_busy)
+           // clip_unnamed will be reset to clip_unnamed_saved
+           // at end_global_changes
+           clip_unnamed_saved = new_unnamed;
+       else
+           clip_unnamed = new_unnamed;
        clip_autoselect_star = new_autoselect_star;
        clip_autoselect_plus = new_autoselect_plus;
        clip_autoselectml = new_autoselectml;
index d3bfaa90df73e790ed627baefaaa661ee03a052d..38dc082dab77cae3d58562ac82320155f295a6ea 100644 (file)
@@ -1,3 +1,4 @@
+source check.vim
 
 func Test_yank_put_clipboard()
   new
@@ -13,6 +14,16 @@ func Test_yank_put_clipboard()
   bwipe!
 endfunc
 
+func Test_global_set_clipboard()
+  CheckFeature clipboard_working
+  new
+  set clipboard=unnamedplus
+  let @+='clipboard' | g/^/set cb= | let @" = 'unnamed' | put
+  call assert_equal(['','unnamed'], getline(1, '$'))
+  set clipboard&
+  bwipe!
+endfunc
+
 func Test_nested_global()
   new
   call setline(1, ['nothing', 'found', 'found bad', 'bad'])
index 05301068270b567603d3737adf9ff286a434b1f8..3fccc702b5fa624e6c9fee37cdc386db8d30e971 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    907,
 /**/
     906,
 /**/