summaryrefslogtreecommitdiff
path: root/src/testdir/view_util.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/view_util.vim')
-rw-r--r--src/testdir/view_util.vim13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/testdir/view_util.vim b/src/testdir/view_util.vim
index cb861bc92..72786da1b 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)