summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0560
blob: 8400253d72df502d6f6702b6c0fadb61517f2519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0560
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0560
Problem:    Cannot use address type "other" with with user command.
Solution:   Add "other" to the list. (Daniel Hahler, closes #3655)  Also
            reject "%" for commands with "other".  Add some more tests.
Files:	    src/ex_docmd.c, src/testdir/test_usercommands.vim


*** ../vim-8.1.0559/src/ex_docmd.c	2018-10-19 22:35:04.885189994 +0200
--- src/ex_docmd.c	2018-12-02 17:58:11.339485922 +0100
***************
*** 2998,3003 ****
--- 2998,3004 ----
  			}
  			break;
  		    case ADDR_TABS_RELATIVE:
+ 		    case ADDR_OTHER:
  			*errormsg = (char_u *)_(e_invrange);
  			return FAIL;
  		    case ADDR_ARGUMENTS:
***************
*** 5940,5945 ****
--- 5941,5947 ----
      {ADDR_BUFFERS, "buffers"},
      {ADDR_WINDOWS, "windows"},
      {ADDR_QUICKFIX, "quickfix"},
+     {ADDR_OTHER, "other"},
      {-1, NULL}
  };
  #endif
*** ../vim-8.1.0559/src/testdir/test_usercommands.vim	2017-12-25 13:39:26.000000000 +0100
--- src/testdir/test_usercommands.vim	2018-12-02 18:17:46.460790379 +0100
***************
*** 154,160 ****
    call assert_equal('"com -nargs=* + 0 1 ?', @:)
  
    call feedkeys(":com -addr=\<C-A>\<C-B>\"\<CR>", 'tx')
!   call assert_equal('"com -addr=arguments buffers lines loaded_buffers quickfix tabs windows', @:)
  
    call feedkeys(":com -complete=co\<C-A>\<C-B>\"\<CR>", 'tx')
    call assert_equal('"com -complete=color command compiler', @:)
--- 154,160 ----
    call assert_equal('"com -nargs=* + 0 1 ?', @:)
  
    call feedkeys(":com -addr=\<C-A>\<C-B>\"\<CR>", 'tx')
!   call assert_equal('"com -addr=arguments buffers lines loaded_buffers other quickfix tabs windows', @:)
  
    call feedkeys(":com -complete=co\<C-A>\<C-B>\"\<CR>", 'tx')
    call assert_equal('"com -complete=color command compiler', @:)
***************
*** 218,220 ****
--- 218,278 ----
    call assert_equal('"DoExec hi', @:)
    delcommand DoExec
  endfunc
+ 
+ func Test_addr_all()
+   command! -addr=lines DoSomething let g:a1 = <line1> | let g:a2 = <line2>
+   %DoSomething
+   call assert_equal(1, g:a1)
+   call assert_equal(line('$'), g:a2)
+ 
+   command! -addr=arguments DoSomething let g:a1 = <line1> | let g:a2 = <line2>
+   args one two three
+   %DoSomething
+   call assert_equal(1, g:a1)
+   call assert_equal(3, g:a2)
+ 
+   command! -addr=buffers DoSomething let g:a1 = <line1> | let g:a2 = <line2>
+   %DoSomething
+   for low in range(1, bufnr('$'))
+     if buflisted(low)
+       break
+     endif
+   endfor
+   call assert_equal(low, g:a1)
+   call assert_equal(bufnr('$'), g:a2)
+ 
+   command! -addr=loaded_buffers DoSomething let g:a1 = <line1> | let g:a2 = <line2>
+   %DoSomething
+   for low in range(1, bufnr('$'))
+     if bufloaded(low)
+       break
+     endif
+   endfor
+   call assert_equal(low, g:a1)
+   for up in range(bufnr('$'), 1, -1)
+     if bufloaded(up)
+       break
+     endif
+   endfor
+   call assert_equal(up, g:a2)
+ 
+   command! -addr=windows DoSomething  let g:a1 = <line1> | let g:a2 = <line2>
+   new
+   %DoSomething
+   call assert_equal(1, g:a1)
+   call assert_equal(winnr('$'), g:a2)
+   bwipe
+ 
+   command! -addr=tabs DoSomething  let g:a1 = <line1> | let g:a2 = <line2>
+   tabnew
+   %DoSomething
+   call assert_equal(1, g:a1)
+   call assert_equal(len(gettabinfo()), g:a2)
+   bwipe
+ 
+   command! -addr=other DoSomething echo 'nothing'
+   DoSomething
+   call assert_fails('%DoSomething')
+ 
+   delcommand DoSomething
+ endfunc
*** ../vim-8.1.0559/src/version.c	2018-12-02 14:55:04.904731741 +0100
--- src/version.c	2018-12-02 18:05:03.897134687 +0100
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     560,
  /**/

-- 
The Characters and incidents portrayed and the names used are fictitious and
any similarity to the names, characters, or history of any person is entirely
accidental and unintentional.
                                  Signed RICHARD M. NIXON
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///