summaryrefslogtreecommitdiff
path: root/src/testdir/view_util.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-03-29 14:16:42 +0100
committerBram Moolenaar <Bram@vim.org>2019-03-29 14:16:42 +0100
commit2912abb3a2fd72074e3901c8ae1d4a77ce764675 (patch)
tree099327af555d07a9322b1f40df94f846e3bfcead /src/testdir/view_util.vim
parente46736b23b7cc25b914415fe4ceb851504f5419c (diff)
downloadvim-git-2912abb3a2fd72074e3901c8ae1d4a77ce764675.tar.gz
patch 8.1.1071: cannot get composing characters from the screenv8.1.1071
Problem: Cannot get composing characters from the screen. Solution: Add screenchars() and screenstring(). (partly by Ozaki Kiichi, closes #4059)
Diffstat (limited to 'src/testdir/view_util.vim')
-rw-r--r--src/testdir/view_util.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/testdir/view_util.vim b/src/testdir/view_util.vim
index 29ea073f9..34b4519bc 100644
--- a/src/testdir/view_util.vim
+++ b/src/testdir/view_util.vim
@@ -5,6 +5,7 @@ if exists('*ScreenLines')
finish
endif
+" Get text on the screen, without composing characters.
" ScreenLines(lnum, width) or
" ScreenLines([start, end], width)
function! ScreenLines(lnum, width) abort
@@ -23,6 +24,25 @@ function! ScreenLines(lnum, width) abort
return lines
endfunction
+" Get text on the screen, including composing characters.
+" ScreenLines(lnum, width) or
+" ScreenLines([start, end], width)
+function! ScreenLinesUtf8(lnum, width) abort
+ redraw!
+ if type(a:lnum) == v:t_list
+ let start = a:lnum[0]
+ let end = a:lnum[1]
+ else
+ let start = a:lnum
+ let end = a:lnum
+ endif
+ let lines = []
+ for l in range(start, end)
+ let lines += [join(map(range(1, a:width), 'screenstring(l, v:val)'), '')]
+ endfor
+ return lines
+endfunction
+
function! ScreenAttrs(lnum, width) abort
redraw!
if type(a:lnum) == v:t_list