Mercurial > vim
annotate src/testdir/view_util.vim @ 14501:77968a364ec4 v8.1.0264
patch 8.1.0264: backup tests fail when CWD is in /tmp
commit https://github.com/vim/vim/commit/efe03738f69b1f63ea30226765db949539ee15f0
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 9 22:26:38 2018 +0200
patch 8.1.0264: backup tests fail when CWD is in /tmp
Problem: Backup tests fail when CWD is in /tmp.
Solution: Make 'backupskip' empty. (Christian Brabandt, closes https://github.com/vim/vim/issues/3301)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 09 Aug 2018 22:30:07 +0200 |
parents | ba55861aa52c |
children | eb087f8a26a8 |
rev | line source |
---|---|
10843
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Functions about view shared by several tests |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
12580
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
3 " Only load this script once. |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
4 if exists('*ScreenLines') |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
5 finish |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
6 endif |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
7 |
10843
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 " ScreenLines(lnum, width) or |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 " ScreenLines([start, end], width) |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 function! ScreenLines(lnum, width) abort |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 redraw! |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 if type(a:lnum) == v:t_list |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 let start = a:lnum[0] |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 let end = a:lnum[1] |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 else |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 let start = a:lnum |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 let end = a:lnum |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 endif |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 let lines = [] |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 for l in range(start, end) |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 let lines += [join(map(range(1, a:width), 'nr2char(screenchar(l, v:val))'), '')] |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 endfor |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 return lines |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 endfunction |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
12580
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
26 function! ScreenAttrs(lnum, width) abort |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
27 redraw! |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
28 if type(a:lnum) == v:t_list |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
29 let start = a:lnum[0] |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
30 let end = a:lnum[1] |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
31 else |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
32 let start = a:lnum |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
33 let end = a:lnum |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
34 endif |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
35 let attrs = [] |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
36 for l in range(start, end) |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
37 let attrs += [map(range(1, a:width), 'screenattr(l, v:val)')] |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
38 endfor |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
39 return attrs |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
40 endfunction |
ba55861aa52c
patch 8.0.1168: wrong highlighting with combination of match and 'cursorline'
Christian Brabandt <cb@256bit.org>
parents:
10843
diff
changeset
|
41 |
10843
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 function! NewWindow(height, width) abort |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 exe a:height . 'new' |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 exe a:width . 'vsp' |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 redraw! |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 endfunction |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 function! CloseWindow() abort |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 bw! |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 redraw! |
678edb254216
patch 8.0.0311: linebreak tests are old style
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 endfunction |