patch 8.1.1581: shared functions for testing are disorganised
Problem: Shared functions for testing are disorganised.
Solution: Group finctions in script files. (Ozaki Kiichi, closes #4573)
diff --git a/src/testdir/view_util.vim b/src/testdir/view_util.vim
index cb861bc..72786da 100644
--- a/src/testdir/view_util.vim
+++ b/src/testdir/view_util.vim
@@ -1,10 +1,21 @@
" Functions about view shared by several tests
" Only load this script once.
-if exists('*ScreenLines')
+if exists('*Screenline')
finish
endif
+" Get line "lnum" as displayed on the screen.
+" Trailing white space is trimmed.
+func Screenline(lnum)
+ let chars = []
+ for c in range(1, winwidth(0))
+ call add(chars, nr2char(screenchar(a:lnum, c)))
+ endfor
+ let line = join(chars, '')
+ return matchstr(line, '^.\{-}\ze\s*$')
+endfunc
+
" Get text on the screen, including composing characters.
" ScreenLines(lnum, width) or
" ScreenLines([start, end], width)