annotate src/testdir/color_ramp.vim @ 33337:19b4f85c2649 v9.0.1932

patch 9.0.1932: Vim9: error when using null object constructor Commit: https://github.com/vim/vim/commit/7398f367d5125eedfb4058c63a5d167fe8601e3d Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sun Sep 24 23:09:10 2023 +0200 patch 9.0.1932: Vim9: error when using null object constructor Problem: Vim9: error when using null object constructor Solution: Check for a null object only when calling an object method closes: #13154 closes: #13163 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Sep 2023 23:15:07 +0200
parents 89364104be93
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Script to generate a file that shows al 256 xterm colors
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 new
20053
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
4 let lnum = 1
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
5
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
6 " | in original color pair to see white background.
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
7 let trail_bar = "\033[m|"
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 " ANSI colors
20053
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
10 call setline(lnum, 'ANSI background')
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
11 let lnum += 1
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
12
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 let s = ''
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 for nr in range(0, 7)
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 let s .= "\033[4" . nr . "m "
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 endfor
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 for nr in range(8, 15)
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 let s .= "\033[10" . (nr - 8) . "m "
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 endfor
20053
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
20 let s .= trail_bar
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
21
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
22 call setline(lnum, s)
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
23 let lnum += 1
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
24
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
25 " ANSI text colors
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
26 call setline(lnum, 'ANSI text')
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
27 let lnum += 1
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
28
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
29 let s = ''
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
30 for nr in range(0, 7)
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
31 let s .= "\033[0;3" . nr . "mxxxx"
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
32 endfor
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
33 for nr in range(8, 15)
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
34 let s .= "\033[0;9" . (nr - 8) . "mxxxx"
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
35 endfor
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
36 let s .= trail_bar
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
37
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
38 call setline(lnum, s)
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
39 let lnum += 1
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
40
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
41 " ANSI with bold text
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
42 call setline(lnum, 'ANSI bold text')
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
43 let lnum += 1
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
44
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
45 let s = ''
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
46 for nr in range(0, 7)
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
47 let s .= "\033[1;3" . nr . "mxxxx"
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
48 endfor
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
49 for nr in range(8, 15)
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
50 let s .= "\033[1;9" . (nr - 8) . "mxxxx"
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
51 endfor
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
52 let s .= trail_bar
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
53
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
54 call setline(lnum, s)
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
55 let lnum += 1
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " 6 x 6 x 6 color cube
20053
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
58 call setline(lnum, 'color cube')
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
59 let lnum += 1
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
60
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 for high in range(0, 5)
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 let s = ''
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 for low in range(0, 35)
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 let nr = low + high * 36
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 let s .= "\033[48;5;" . (nr + 16) . "m "
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 endfor
20053
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
67 let s .= trail_bar
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
68 call setline(lnum + high, s)
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 endfor
20053
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
70 let lnum += 6
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 " 24 shades of grey
20053
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
73 call setline(lnum, 'grey ramp')
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
74 let lnum += 1
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
75
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 let s = ''
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 for nr in range(0, 23)
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 let s .= "\033[48;5;" . (nr + 232) . "m "
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 endfor
20053
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
80 let s .= trail_bar
89364104be93 patch 8.2.0582: color ramp test does not show text colors
Bram Moolenaar <Bram@vim.org>
parents: 12944
diff changeset
81 call setline(lnum, s)
12944
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 set binary
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 write! <sfile>:h/color_ramp.txt
2d54f1e7ba0f patch 8.0.1348: make testclean deletes script file on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 quit