summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorJohn Marriott <basilisk@internode.on.net>2024-04-02 20:26:01 +0200
committerChristian Brabandt <cb@256bit.org>2024-04-02 20:26:01 +0200
commit78d742ab8845578f78039ddd71a6444c6929257c (patch)
treed782bcc5d36c4259b05f29fe1d41e1845c9578e2 /src/testdir
parent16cdfa69e07190674a8e85a48144a467472ca2f4 (diff)
patch 9.1.0256: Finding autocmd events is inefficientv9.1.0256
Problem: Finding autocmd events is inefficient Solution: Use binary search to find events, cache last found events, avoid use of strlen(), add SessionWritePost autocmd, fix test_codestyle and avoid endless loop (John Marriott) closes: #14287 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_codestyle.vim8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim
index 359410d2d0..a455264de7 100644
--- a/src/testdir/test_codestyle.vim
+++ b/src/testdir/test_codestyle.vim
@@ -7,13 +7,17 @@ def s:ReportError(fname: string, lnum: number, msg: string)
enddef
def s:PerformCheck(fname: string, pattern: string, msg: string, skip: string)
+ var prev_lnum = 1
var lnum = 1
while (lnum > 0)
cursor(lnum, 1)
lnum = search(pattern, 'W', 0, 0, skip)
- ReportError(fname, lnum, msg)
+ if (prev_lnum == lnum)
+ break
+ endif
+ prev_lnum = lnum
if (lnum > 0)
- lnum += 1
+ ReportError(fname, lnum, msg)
endif
endwhile
enddef