diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-03-29 19:20:41 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-03-29 19:20:41 +0200 |
commit | 3fcfa35f82b9d1ef5e95051b3a45578e10c14ec3 (patch) | |
tree | 84aa6be11d89fb6fa012413667901ad75e32c8b1 /src | |
parent | 99a6e8dd824399332563caa6cacfcda33da1f366 (diff) | |
download | vim-3fcfa35f82b9d1ef5e95051b3a45578e10c14ec3.zip |
patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Problem: MS-Windows: when 'clipboard' is "unnamed" yyp does not work in a
:global command.
Solution: When setting the clipboard was postponed, do not clear the
register.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 1 | ||||
-rw-r--r-- | src/globals.h | 1 | ||||
-rw-r--r-- | src/ops.c | 2 | ||||
-rw-r--r-- | src/proto/ui.pro | 1 | ||||
-rw-r--r-- | src/testdir/test_alot.vim | 3 | ||||
-rw-r--r-- | src/testdir/test_global.vim | 11 | ||||
-rw-r--r-- | src/ui.c | 16 | ||||
-rw-r--r-- | src/version.c | 2 |
8 files changed, 31 insertions, 6 deletions
diff --git a/src/Makefile b/src/Makefile index e8314ea6e..82da653e7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2145,6 +2145,7 @@ test_arglist \ test_ga \ test_gf \ test_glob2regpat \ + test_global \ test_gn \ test_goto \ test_gui \ diff --git a/src/globals.h b/src/globals.h index 59193e07a..28b71ac85 100644 --- a/src/globals.h +++ b/src/globals.h @@ -532,7 +532,6 @@ EXTERN int clip_autoselect_plus INIT(= FALSE); EXTERN int clip_autoselectml INIT(= FALSE); EXTERN int clip_html INIT(= FALSE); EXTERN regprog_T *clip_exclude_prog INIT(= NULL); -EXTERN int clip_did_set_selection INIT(= TRUE); EXTERN int clip_unnamed_saved INIT(= 0); #endif @@ -6466,7 +6466,7 @@ clip_get_selection(VimClipboard *cbd) VIsual = old_visual; VIsual_mode = old_visual_mode; } - else + else if (!is_clipboard_needs_update()) { clip_free_selection(cbd); diff --git a/src/proto/ui.pro b/src/proto/ui.pro index dbb721396..47c0fef68 100644 --- a/src/proto/ui.pro +++ b/src/proto/ui.pro @@ -16,6 +16,7 @@ void clip_update_selection(VimClipboard *clip); void clip_own_selection(VimClipboard *cbd); void clip_lose_selection(VimClipboard *cbd); void start_global_changes(void); +int is_clipboard_needs_update(void); void end_global_changes(void); void clip_auto_select(void); int clip_isautosel_star(void); diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim index 7b31575ae..56a3f8edf 100644 --- a/src/testdir/test_alot.vim +++ b/src/testdir/test_alot.vim @@ -21,8 +21,9 @@ source test_findfile.vim source test_float_func.vim source test_fnamemodify.vim source test_functions.vim -source test_glob2regpat.vim source test_ga.vim +source test_glob2regpat.vim +source test_global.vim source test_goto.vim source test_help_tagjump.vim source test_join.vim diff --git a/src/testdir/test_global.vim b/src/testdir/test_global.vim new file mode 100644 index 000000000..be8aa6962 --- /dev/null +++ b/src/testdir/test_global.vim @@ -0,0 +1,11 @@ + +func Test_yank_put_clipboard() + new + call setline(1, ['a', 'b', 'c']) + set clipboard=unnamed + g/^/normal yyp + call assert_equal(['a', 'a', 'b', 'b', 'c', 'c'], getline(1, 6)) + + set clipboard& + bwipe! +endfunc @@ -392,8 +392,6 @@ ui_breakcheck_force(int force) #if defined(FEAT_CLIPBOARD) || defined(PROTO) -static void clip_copy_selection(VimClipboard *clip); - /* * Selection stuff using Visual mode, for cutting and pasting text to other * windows. @@ -569,7 +567,8 @@ clip_copy_selection(VimClipboard *clip) * considerably. */ static int global_change_count = 0; /* if set, inside a start_global_changes */ -static int clipboard_needs_update; /* clipboard needs to be updated */ +static int clipboard_needs_update = FALSE; /* clipboard needs to be updated */ +static int clip_did_set_selection = TRUE; /* * Save clip_unnamed and reset it. @@ -590,6 +589,16 @@ start_global_changes(void) } /* + * Return TRUE if setting the clipboard was postponed, it already contains the + * right text. + */ + int +is_clipboard_needs_update() +{ + return clipboard_needs_update; +} + +/* * Restore clip_unnamed and set the selection when needed. */ void @@ -619,6 +628,7 @@ end_global_changes(void) } } } + clipboard_needs_update = FALSE; } /* diff --git a/src/version.c b/src/version.c index 539052b51..90ec27bf8 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 522, +/**/ 521, /**/ 520, |