Skip to content

Commit 27a5432

Browse files
committed
Fix error with ResultListDo
Reported by Pomakhin Also add a test to exercise the functionality
1 parent ae5faf6 commit 27a5432

File tree

5 files changed

+59
-3
lines changed

5 files changed

+59
-3
lines changed

plugin/EasyGrep.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3104,7 +3104,7 @@ function! s:DoReplace(target, replacement, wholeword, escapeArgs)
31043104

31053105
let finished = 0
31063106
let lastFile = -1
3107-
let doAll = 0
3107+
let doAll = exists("g:EasyGrepAutomatedTest")
31083108
let i = 0
31093109
while i < numMatches && !finished
31103110
try
@@ -3385,7 +3385,7 @@ function! s:ResultListDo(command)
33853385

33863386
let finished = 0
33873387
let lastFile = -1
3388-
let doAll = 0
3388+
let doAll = exists("g:EasyGrepAutomatedTest")
33893389
let i = 0
33903390
while i < numMatches && !finished
33913391
try
@@ -3473,7 +3473,7 @@ function! s:ResultListDo(command)
34733473
endif
34743474

34753475
if doit
3476-
exe .a:command
3476+
exe a:command
34773477
endif
34783478

34793479
if pendingQuit

tests/__resultlistdo.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resultlistdo
2+
resultlistopen

tests/resultlistdo.ok

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
|1 col 1| GrepAdd resultlist
2+
__resultlistdo.in|1 col 1| resultlistdo
3+
__resultlistdo.in|2 col 1| resultlistopen
4+
__resultlistdo.in|1 col 1| GrepAdd resultlistfroo
5+
__resultlistdo.in|1 col 1| resultlistfroo
6+
__resultlistdo.in|1 col 1| GrepAdd resultlist
7+
__resultlistdo.in|1 col 1| resultlistdo
8+
__resultlistdo.in|2 col 1| resultlistopen

tests/resultlistdo.vim

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
let testname="resultlistdo"
3+
let g:EasyGrepDefaultUserPattern="__resultlistdo.in"
4+
let g:EasyGrepMode=3
5+
let g:EasyGrepAutomated=1
6+
7+
" Search
8+
ResultListTag GrepAdd resultlist
9+
GrepAdd resultlist
10+
11+
" Exercise
12+
ResultListDo s/resultlistdo/resultlistfroo/e
13+
wa
14+
15+
" Search
16+
ResultListTag GrepAdd resultlistfroo
17+
GrepAdd resultlistfroo
18+
19+
" Restore the input
20+
ResultListDo s/resultlistfroo/resultlistdo/e
21+
wa
22+
23+
" Search again
24+
ResultListTag GrepAdd resultlist
25+
GrepAdd resultlist
26+
27+
" Save results
28+
exe "ResultListSave ".testname.".out"
29+
30+
cclose
31+
quitall!

tests/vimgrep.suite

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
#-------------------------------------------------------------------------------
3+
# Grep tests
4+
#-------------------------------------------------------------------------------
5+
26
# casesensitivity
37
casesensitivity_ack.vim
48
casesensitivity_ag.vim
@@ -33,3 +37,14 @@ simpleregex_ag.vim
3337
simpleregex_grep.vim
3438
simpleregex_pt.vim
3539
simpleregex_vimgrep.vim
40+
41+
#-------------------------------------------------------------------------------
42+
# ResultList tests
43+
#-------------------------------------------------------------------------------
44+
45+
46+
#-------------
47+
# ResultListDo
48+
#-------------
49+
resultlistdo_vimgrep.vim
50+

0 commit comments

Comments
 (0)