annotate src/testdir/test_global.vim @ 20707:ec89debe5037 v8.2.0907

patch 8.2.0907: when using :global clipboard isn't set correctly Commit: https://github.com/vim/vim/commit/07188fc5ef2366a3b1952e8686a4031b44152d59 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jun 5 20:03:16 2020 +0200 patch 8.2.0907: when using :global clipboard isn't set correctly Problem: When using :global clipboard isn't set correctly. Solution: Set "clip_unnamed_saved" instead of "clip_unnamed". (Christian Brabandt, closes #6203, closes #6198)
author Bram Moolenaar <Bram@vim.org>
date Fri, 05 Jun 2020 20:15:04 +0200
parents 0208534b8a84
children 6a4806e326dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20707
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
1 source check.vim
11273
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 func Test_yank_put_clipboard()
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 new
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 call setline(1, ['a', 'b', 'c'])
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 set clipboard=unnamed
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 g/^/normal yyp
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal(['a', 'a', 'b', 'b', 'c', 'c'], getline(1, 6))
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
9 set clipboard=unnamed,unnamedplus
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
10 call setline(1, ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
11 g/^/normal yyp
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19471
diff changeset
12 call assert_equal(['a', 'a', 'b', 'b', 'c', 'c'], getline(1, 6))
11273
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 set clipboard&
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 bwipe!
96d83cd2904a patch 8.0.0522: Win32: when 'clipboard' is "unnamed" yyp does not work
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 endfunc
11494
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
16
20707
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
17 func Test_global_set_clipboard()
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
18 CheckFeature clipboard_working
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
19 new
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
20 set clipboard=unnamedplus
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
21 let @+='clipboard' | g/^/set cb= | let @" = 'unnamed' | put
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
22 call assert_equal(['','unnamed'], getline(1, '$'))
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
23 set clipboard&
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
24 bwipe!
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
25 endfunc
ec89debe5037 patch 8.2.0907: when using :global clipboard isn't set correctly
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
26
11494
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
27 func Test_nested_global()
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
28 new
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
29 call setline(1, ['nothing', 'found', 'found bad', 'bad'])
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
30 call assert_fails('g/found/3v/bad/s/^/++/', 'E147')
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
31 g/found/v/bad/s/^/++/
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
32 call assert_equal(['nothing', '++found', 'found bad', 'bad'], getline(1, 4))
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
33 bwipe!
8e5ec22db3d8 patch 8.0.0630: it is not easy to work on lines without a match
Christian Brabandt <cb@256bit.org>
parents: 11273
diff changeset
34 endfunc
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
35
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
36 func Test_global_error()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
37 call assert_fails('g\\a', 'E10:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
38 call assert_fails('g', 'E148:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
39 call assert_fails('g/\(/y', 'E476:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
40 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
41
19277
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
42 " Test for printing lines using :g with different search patterns
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
43 func Test_global_print()
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
44 new
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
45 call setline(1, ['foo', 'bar', 'foo', 'foo'])
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
46 let @/ = 'foo'
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
47 let t = execute("g/")->trim()->split("\n")
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
48 call assert_equal(['foo', 'foo', 'foo'], t)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
49
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
50 " Test for Vi compatible patterns
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
51 let @/ = 'bar'
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
52 let t = execute('g\/')->trim()->split("\n")
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
53 call assert_equal(['bar'], t)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
54
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
55 normal gg
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
56 s/foo/foo/
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
57 let t = execute('g\&')->trim()->split("\n")
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
58 call assert_equal(['foo', 'foo', 'foo'], t)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
59
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
60 let @/ = 'bar'
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
61 let t = execute('g?')->trim()->split("\n")
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
62 call assert_equal(['bar'], t)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
63
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
64 " Test for the 'Pattern found in every line' message
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
65 let v:statusmsg = ''
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
66 v/foo\|bar/p
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
67 call assert_notequal('', v:statusmsg)
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
68
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
69 close!
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
70 endfunc
1b02482e6a61 patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
71
19471
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
72 " Test for global command with newline character
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
73 func Test_global_newline()
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
74 new
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
75 call setline(1, ['foo'])
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
76 exe "g/foo/s/f/h/\<NL>s/o$/w/"
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
77 call assert_equal('how', getline(1))
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
78 call setline(1, ["foo\<NL>bar"])
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
79 exe "g/foo/s/foo\\\<NL>bar/xyz/"
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
80 call assert_equal('xyz', getline(1))
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
81 close!
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
82 endfunc
cb73f4ae6b7c patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19277
diff changeset
83
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 11494
diff changeset
84 " vim: shiftwidth=2 sts=2 expandtab