patch 9.1.0256: Finding autocmd events is inefficient
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>
diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim
index 359410d..a455264 100644
--- a/src/testdir/test_codestyle.vim
+++ b/src/testdir/test_codestyle.vim
@@ -7,13 +7,17 @@
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