highlight_spec.lua 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local Screen = require('test.functional.ui.screen')
  3. local os = require('os')
  4. local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert
  5. local command = helpers.command
  6. local eval, exc_exec = helpers.eval, helpers.exc_exec
  7. local feed_command, eq = helpers.feed_command, helpers.eq
  8. local curbufmeths = helpers.curbufmeths
  9. describe('colorscheme compatibility', function()
  10. before_each(function()
  11. clear()
  12. end)
  13. it('t_Co is set to 256 by default', function()
  14. eq('256', eval('&t_Co'))
  15. end)
  16. end)
  17. describe('highlight: `:syntax manual`', function()
  18. -- When using manual syntax highlighting, it should be preserved even when
  19. -- switching buffers... bug did only occur without :set hidden
  20. -- Ref: vim patch 7.4.1236
  21. local screen
  22. before_each(function()
  23. clear()
  24. screen = Screen.new(20,5)
  25. screen:attach()
  26. --syntax highlight for vimcscripts "echo"
  27. screen:set_default_attr_ids( {
  28. [0] = {bold=true, foreground=Screen.colors.Blue},
  29. [1] = {bold=true, foreground=Screen.colors.Brown}
  30. } )
  31. end)
  32. after_each(function()
  33. screen:detach()
  34. os.remove('Xtest-functional-ui-highlight.tmp.vim')
  35. end)
  36. it("works with buffer switch and 'hidden'", function()
  37. command('e tmp1.vim')
  38. command('e Xtest-functional-ui-highlight.tmp.vim')
  39. command('filetype on')
  40. command('syntax manual')
  41. command('set ft=vim')
  42. command('set syntax=ON')
  43. feed('iecho 1<esc>0')
  44. command('set hidden')
  45. command('w')
  46. command('bn')
  47. feed_command('bp')
  48. screen:expect([[
  49. {1:^echo} 1 |
  50. {0:~ }|
  51. {0:~ }|
  52. {0:~ }|
  53. :bp |
  54. ]])
  55. end)
  56. it("works with buffer switch and 'nohidden'", function()
  57. command('e tmp1.vim')
  58. command('e Xtest-functional-ui-highlight.tmp.vim')
  59. command('filetype on')
  60. command('syntax manual')
  61. command('set filetype=vim fileformat=unix')
  62. command('set syntax=ON')
  63. feed('iecho 1<esc>0')
  64. command('set nohidden')
  65. command('w')
  66. command('silent bn')
  67. eq("tmp1.vim", eval("fnamemodify(bufname('%'), ':t')"))
  68. feed_command('silent bp')
  69. eq("Xtest-functional-ui-highlight.tmp.vim", eval("fnamemodify(bufname('%'), ':t')"))
  70. screen:expect([[
  71. {1:^echo} 1 |
  72. {0:~ }|
  73. {0:~ }|
  74. {0:~ }|
  75. :silent bp |
  76. ]])
  77. end)
  78. end)
  79. describe('highlight defaults', function()
  80. local screen
  81. before_each(function()
  82. clear()
  83. screen = Screen.new()
  84. screen:attach()
  85. command("set display-=msgsep")
  86. end)
  87. after_each(function()
  88. screen:detach()
  89. end)
  90. it('window status bar', function()
  91. screen:set_default_attr_ids({
  92. [0] = {bold=true, foreground=Screen.colors.Blue},
  93. [1] = {reverse = true, bold = true}, -- StatusLine
  94. [2] = {reverse = true} -- StatusLineNC
  95. })
  96. feed_command('sp', 'vsp', 'vsp')
  97. screen:expect([[
  98. ^ {2:│} {2:│} |
  99. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  100. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  101. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  102. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  103. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  104. {1:[No Name] }{2:[No Name] [No Name] }|
  105. |
  106. {0:~ }|
  107. {0:~ }|
  108. {0:~ }|
  109. {0:~ }|
  110. {2:[No Name] }|
  111. :vsp |
  112. ]])
  113. -- navigate to verify that the attributes are properly moved
  114. feed('<c-w>j')
  115. screen:expect([[
  116. {2:│} {2:│} |
  117. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  118. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  119. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  120. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  121. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  122. {2:[No Name] [No Name] [No Name] }|
  123. ^ |
  124. {0:~ }|
  125. {0:~ }|
  126. {0:~ }|
  127. {0:~ }|
  128. {1:[No Name] }|
  129. :vsp |
  130. ]])
  131. -- note that when moving to a window with small width nvim will increase
  132. -- the width of the new active window at the expense of a inactive window
  133. -- (upstream vim has the same behavior)
  134. feed('<c-w>k<c-w>l')
  135. screen:expect([[
  136. {2:│}^ {2:│} |
  137. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  138. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  139. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  140. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  141. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  142. {2:[No Name] }{1:[No Name] }{2:[No Name] }|
  143. |
  144. {0:~ }|
  145. {0:~ }|
  146. {0:~ }|
  147. {0:~ }|
  148. {2:[No Name] }|
  149. :vsp |
  150. ]])
  151. feed('<c-w>l')
  152. screen:expect([[
  153. {2:│} {2:│}^ |
  154. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  155. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  156. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  157. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  158. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  159. {2:[No Name] [No Name] }{1:[No Name] }|
  160. |
  161. {0:~ }|
  162. {0:~ }|
  163. {0:~ }|
  164. {0:~ }|
  165. {2:[No Name] }|
  166. :vsp |
  167. ]])
  168. feed('<c-w>h<c-w>h')
  169. screen:expect([[
  170. ^ {2:│} {2:│} |
  171. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  172. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  173. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  174. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  175. {0:~ }{2:│}{0:~ }{2:│}{0:~ }|
  176. {1:[No Name] }{2:[No Name] [No Name] }|
  177. |
  178. {0:~ }|
  179. {0:~ }|
  180. {0:~ }|
  181. {0:~ }|
  182. {2:[No Name] }|
  183. :vsp |
  184. ]])
  185. end)
  186. it('insert mode text', function()
  187. feed('i')
  188. screen:try_resize(53, 4)
  189. screen:expect([[
  190. ^ |
  191. {0:~ }|
  192. {0:~ }|
  193. {1:-- INSERT --} |
  194. ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
  195. [1] = {bold = true}})
  196. end)
  197. it('end of file markers', function()
  198. screen:try_resize(53, 4)
  199. screen:expect([[
  200. ^ |
  201. {1:~ }|
  202. {1:~ }|
  203. |
  204. ]], {[1] = {bold = true, foreground = Screen.colors.Blue}})
  205. end)
  206. it('"wait return" text', function()
  207. screen:try_resize(53, 4)
  208. feed(':ls<cr>')
  209. screen:expect([[
  210. {0:~ }|
  211. :ls |
  212. 1 %a "[No Name]" line 1 |
  213. {1:Press ENTER or type command to continue}^ |
  214. ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
  215. [1] = {bold = true, foreground = Screen.colors.SeaGreen}})
  216. feed('<cr>') -- skip the "Press ENTER..." state or tests will hang
  217. end)
  218. it('can be cleared and linked to other highlight groups', function()
  219. screen:try_resize(53, 4)
  220. feed_command('highlight clear ModeMsg')
  221. feed('i')
  222. screen:expect([[
  223. ^ |
  224. {0:~ }|
  225. {0:~ }|
  226. -- INSERT -- |
  227. ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
  228. [1] = {bold=true}})
  229. feed('<esc>')
  230. feed_command('highlight CustomHLGroup guifg=red guibg=green')
  231. feed_command('highlight link ModeMsg CustomHLGroup')
  232. feed('i')
  233. screen:expect([[
  234. ^ |
  235. {0:~ }|
  236. {0:~ }|
  237. {1:-- INSERT --} |
  238. ]], {[0] = {bold=true, foreground=Screen.colors.Blue},
  239. [1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}})
  240. end)
  241. it('can be cleared by assigning NONE', function()
  242. screen:try_resize(53, 4)
  243. feed_command('syn keyword TmpKeyword neovim')
  244. feed_command('hi link TmpKeyword ErrorMsg')
  245. insert('neovim')
  246. screen:expect([[
  247. {1:neovi^m} |
  248. {0:~ }|
  249. {0:~ }|
  250. |
  251. ]], {
  252. [0] = {bold=true, foreground=Screen.colors.Blue},
  253. [1] = {foreground = Screen.colors.White, background = Screen.colors.Red}
  254. })
  255. feed_command("hi ErrorMsg term=NONE cterm=NONE ctermfg=NONE ctermbg=NONE"
  256. .. " gui=NONE guifg=NONE guibg=NONE guisp=NONE")
  257. screen:expect([[
  258. neovi^m |
  259. {0:~ }|
  260. {0:~ }|
  261. |
  262. ]], {[0] = {bold=true, foreground=Screen.colors.Blue}})
  263. end)
  264. it('Cursor after `:hi clear|syntax reset` #6508', function()
  265. command('highlight clear|syntax reset')
  266. eq('guifg=bg guibg=fg', eval([[matchstr(execute('hi Cursor'), '\v(gui|cterm).*$')]]))
  267. end)
  268. it('Whitespace highlight', function()
  269. screen:try_resize(53, 4)
  270. feed_command('highlight NonText gui=NONE guifg=#FF0000')
  271. feed_command('set listchars=space:.,tab:>-,trail:*,eol:¬ list')
  272. insert(' ne \t o\tv im ')
  273. screen:expect([[
  274. ne{0:.>----.}o{0:>-----}v{0:..}im{0:*^*¬} |
  275. {0:~ }|
  276. {0:~ }|
  277. |
  278. ]], {
  279. [0] = {foreground=Screen.colors.Red},
  280. [1] = {foreground=Screen.colors.Blue},
  281. })
  282. feed_command('highlight Whitespace gui=NONE guifg=#0000FF')
  283. screen:expect([[
  284. ne{1:.>----.}o{1:>-----}v{1:..}im{1:*^*}{0:¬} |
  285. {0:~ }|
  286. {0:~ }|
  287. :highlight Whitespace gui=NONE guifg=#0000FF |
  288. ]], {
  289. [0] = {foreground=Screen.colors.Red},
  290. [1] = {foreground=Screen.colors.Blue},
  291. })
  292. end)
  293. end)
  294. describe('highlight', function()
  295. local screen
  296. before_each(function()
  297. clear()
  298. screen = Screen.new(25,10)
  299. screen:attach()
  300. end)
  301. it('cterm=standout gui=standout', function()
  302. screen:detach()
  303. screen = Screen.new(20,5)
  304. screen:attach()
  305. screen:set_default_attr_ids({
  306. [1] = {bold = true, foreground = Screen.colors.Blue1},
  307. [2] = {standout = true, bold = true, underline = true,
  308. background = Screen.colors.Gray90, foreground = Screen.colors.Blue1},
  309. [3] = {standout = true, underline = true,
  310. background = Screen.colors.Gray90}
  311. })
  312. feed_command('hi CursorLine cterm=standout,underline gui=standout,underline')
  313. feed_command('set cursorline')
  314. feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
  315. feed('i\t abcd <cr>\t abcd <cr><esc>k')
  316. screen:expect([[
  317. {1:>-------.}abcd{1:*¬} |
  318. {2:^>-------.}{3:abcd}{2:*¬}{3: }|
  319. {1:¬} |
  320. {1:~ }|
  321. |
  322. ]])
  323. end)
  324. it('guisp (special/undercurl)', function()
  325. feed_command('syntax on')
  326. feed_command('syn keyword TmpKeyword neovim')
  327. feed_command('syn keyword TmpKeyword1 special')
  328. feed_command('syn keyword TmpKeyword2 specialwithbg')
  329. feed_command('syn keyword TmpKeyword3 specialwithfg')
  330. feed_command('hi! Awesome guifg=red guibg=yellow guisp=red')
  331. feed_command('hi! Awesome1 guisp=red')
  332. feed_command('hi! Awesome2 guibg=yellow guisp=red')
  333. feed_command('hi! Awesome3 guifg=red guisp=red')
  334. feed_command('hi link TmpKeyword Awesome')
  335. feed_command('hi link TmpKeyword1 Awesome1')
  336. feed_command('hi link TmpKeyword2 Awesome2')
  337. feed_command('hi link TmpKeyword3 Awesome3')
  338. insert([[
  339. neovim
  340. awesome neovim
  341. wordcontainingneovim
  342. special
  343. specialwithbg
  344. specialwithfg
  345. ]])
  346. feed('Go<tab>neovim tabbed')
  347. screen:expect([[
  348. {1:neovim} |
  349. awesome {1:neovim} |
  350. wordcontainingneovim |
  351. {2:special} |
  352. {3:specialwithbg} |
  353. {4:specialwithfg} |
  354. |
  355. {1:neovim} tabbed^ |
  356. {0:~ }|
  357. {5:-- INSERT --} |
  358. ]],{
  359. [0] = {bold=true, foreground=Screen.colors.Blue},
  360. [1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red,
  361. special = Screen.colors.Red},
  362. [2] = {special = Screen.colors.Red},
  363. [3] = {special = Screen.colors.Red, background = Screen.colors.Yellow},
  364. [4] = {foreground = Screen.colors.Red, special = Screen.colors.Red},
  365. [5] = {bold=true},
  366. })
  367. end)
  368. end)
  369. describe("'listchars' highlight", function()
  370. local screen
  371. before_each(function()
  372. clear()
  373. screen = Screen.new(20,5)
  374. screen:attach()
  375. end)
  376. after_each(function()
  377. screen:detach()
  378. end)
  379. it("'cursorline' and 'cursorcolumn'", function()
  380. screen:set_default_attr_ids({
  381. [0] = {bold=true, foreground=Screen.colors.Blue},
  382. [1] = {background=Screen.colors.Grey90}
  383. })
  384. feed_command('highlight clear ModeMsg')
  385. feed_command('set cursorline')
  386. feed('i')
  387. screen:expect([[
  388. {1:^ }|
  389. {0:~ }|
  390. {0:~ }|
  391. {0:~ }|
  392. -- INSERT -- |
  393. ]])
  394. feed('abcdefg<cr>kkasdf')
  395. screen:expect([[
  396. abcdefg |
  397. {1:kkasdf^ }|
  398. {0:~ }|
  399. {0:~ }|
  400. -- INSERT -- |
  401. ]])
  402. feed('<esc>')
  403. screen:expect([[
  404. abcdefg |
  405. {1:kkasd^f }|
  406. {0:~ }|
  407. {0:~ }|
  408. |
  409. ]])
  410. feed_command('set nocursorline')
  411. screen:expect([[
  412. abcdefg |
  413. kkasd^f |
  414. {0:~ }|
  415. {0:~ }|
  416. :set nocursorline |
  417. ]])
  418. feed('k')
  419. screen:expect([[
  420. abcde^fg |
  421. kkasdf |
  422. {0:~ }|
  423. {0:~ }|
  424. :set nocursorline |
  425. ]])
  426. feed('jjji<cr><cr><cr><esc>')
  427. screen:expect([[
  428. kkasd |
  429. |
  430. |
  431. ^f |
  432. |
  433. ]])
  434. feed_command('set cursorline')
  435. feed_command('set cursorcolumn')
  436. feed('kkiabcdefghijk<esc>hh')
  437. screen:expect([[
  438. kkasd {1: } |
  439. {1:abcdefgh^ijk }|
  440. {1: } |
  441. f {1: } |
  442. |
  443. ]])
  444. feed('khh')
  445. screen:expect([[
  446. {1:kk^asd }|
  447. ab{1:c}defghijk |
  448. {1: } |
  449. f {1: } |
  450. |
  451. ]])
  452. end)
  453. it("'cursorline' and with 'listchar' option: space, eol, tab, and trail", function()
  454. screen:set_default_attr_ids({
  455. [1] = {background=Screen.colors.Grey90},
  456. [2] = {
  457. foreground=Screen.colors.Red,
  458. background=Screen.colors.Grey90,
  459. },
  460. [3] = {
  461. background=Screen.colors.Grey90,
  462. foreground=Screen.colors.Blue,
  463. bold=true,
  464. },
  465. [4] = {
  466. foreground=Screen.colors.Blue,
  467. bold=true,
  468. },
  469. [5] = {
  470. foreground=Screen.colors.Red,
  471. },
  472. })
  473. feed_command('highlight clear ModeMsg')
  474. feed_command('highlight Whitespace guifg=#FF0000')
  475. feed_command('set cursorline')
  476. feed_command('set tabstop=8')
  477. feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
  478. feed('i\t abcd <cr>\t abcd <cr><esc>k')
  479. screen:expect([[
  480. {5:>-------.}abcd{5:*}{4:¬} |
  481. {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
  482. {4:¬} |
  483. {4:~ }|
  484. |
  485. ]])
  486. feed('k')
  487. screen:expect([[
  488. {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
  489. {5:>-------.}abcd{5:*}{4:¬} |
  490. {4:¬} |
  491. {4:~ }|
  492. |
  493. ]])
  494. feed_command('set nocursorline')
  495. screen:expect([[
  496. {5:^>-------.}abcd{5:*}{4:¬} |
  497. {5:>-------.}abcd{5:*}{4:¬} |
  498. {4:¬} |
  499. {4:~ }|
  500. :set nocursorline |
  501. ]])
  502. feed_command('set nowrap')
  503. feed('ALorem ipsum dolor sit amet<ESC>0')
  504. screen:expect([[
  505. {5:^>-------.}abcd{5:.}Lorem{4:>}|
  506. {5:>-------.}abcd{5:*}{4:¬} |
  507. {4:¬} |
  508. {4:~ }|
  509. |
  510. ]])
  511. feed_command('set cursorline')
  512. screen:expect([[
  513. {2:^>-------.}{1:abcd}{2:.}{1:Lorem}{3:>}|
  514. {5:>-------.}abcd{5:*}{4:¬} |
  515. {4:¬} |
  516. {4:~ }|
  517. :set cursorline |
  518. ]])
  519. feed('$')
  520. screen:expect([[
  521. {3:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }|
  522. {4:<} |
  523. {4:<} |
  524. {4:~ }|
  525. :set cursorline |
  526. ]])
  527. feed('G')
  528. screen:expect([[
  529. {5:>-------.}abcd{5:.}Lorem{4:>}|
  530. {5:>-------.}abcd{5:*}{4:¬} |
  531. {3:^¬}{1: }|
  532. {4:~ }|
  533. :set cursorline |
  534. ]])
  535. end)
  536. it("'listchar' in visual mode", function()
  537. screen:set_default_attr_ids({
  538. [1] = {background=Screen.colors.Grey90},
  539. [2] = {
  540. foreground=Screen.colors.Red,
  541. background=Screen.colors.Grey90,
  542. },
  543. [3] = {
  544. background=Screen.colors.Grey90,
  545. foreground=Screen.colors.Blue,
  546. bold=true,
  547. },
  548. [4] = {
  549. foreground=Screen.colors.Blue,
  550. bold=true,
  551. },
  552. [5] = {
  553. foreground=Screen.colors.Red,
  554. },
  555. [6] = {
  556. background=Screen.colors.LightGrey,
  557. },
  558. [7] = {
  559. background=Screen.colors.LightGrey,
  560. foreground=Screen.colors.Red,
  561. },
  562. [8] = {
  563. background=Screen.colors.LightGrey,
  564. foreground=Screen.colors.Blue,
  565. bold=true,
  566. },
  567. })
  568. feed_command('highlight clear ModeMsg')
  569. feed_command('highlight Whitespace guifg=#FF0000')
  570. feed_command('set cursorline')
  571. feed_command('set tabstop=8')
  572. feed_command('set nowrap')
  573. feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
  574. feed('i\t abcd <cr>\t abcd Lorem ipsum dolor sit amet<cr><esc>kkk0')
  575. screen:expect([[
  576. {2:^>-------.}{1:abcd}{2:*}{3:¬}{1: }|
  577. {5:>-------.}abcd{5:.}Lorem{4:>}|
  578. {4:¬} |
  579. {4:~ }|
  580. |
  581. ]])
  582. feed('lllvj')
  583. screen:expect([[
  584. {5:>-------.}a{6:bcd}{7:*}{8:¬} |
  585. {7:>-------.}{6:a}^bcd{5:.}Lorem{4:>}|
  586. {4:¬} |
  587. {4:~ }|
  588. -- VISUAL -- |
  589. ]])
  590. feed('<esc>V')
  591. screen:expect([[
  592. {5:>-------.}abcd{5:*}{4:¬} |
  593. {7:>-------.}{6:a}^b{6:cd}{7:.}{6:Lorem}{4:>}|
  594. {4:¬} |
  595. {4:~ }|
  596. -- VISUAL LINE -- |
  597. ]])
  598. feed('<esc>$')
  599. screen:expect([[
  600. {4:<} |
  601. {3:<}{1:r}{2:.}{1:sit}{2:.}{1:ame^t}{3:¬}{1: }|
  602. {4:<} |
  603. {4:~ }|
  604. |
  605. ]])
  606. end)
  607. it("'cursorline' with :match", function()
  608. screen:set_default_attr_ids({
  609. [0] = {bold=true, foreground=Screen.colors.Blue},
  610. [1] = {background=Screen.colors.Grey90},
  611. [2] = {foreground=Screen.colors.Red},
  612. [3] = {foreground=Screen.colors.Green1},
  613. })
  614. feed_command('highlight clear ModeMsg')
  615. feed_command('highlight Whitespace guifg=#FF0000')
  616. feed_command('highlight Error guifg=#00FF00')
  617. feed_command('set nowrap')
  618. feed('ia \t bc \t <esc>')
  619. screen:expect([[
  620. a bc ^ |
  621. {0:~ }|
  622. {0:~ }|
  623. {0:~ }|
  624. |
  625. ]])
  626. feed_command('set listchars=space:.,eol:¬,tab:>-,extends:>,precedes:<,trail:* list')
  627. screen:expect([[
  628. a{2:.>-----.}bc{2:*>---*^*}{0:¬} |
  629. {0:~ }|
  630. {0:~ }|
  631. {0:~ }|
  632. |
  633. ]])
  634. feed_command('match Error /\\s\\+$/')
  635. screen:expect([[
  636. a{2:.>-----.}bc{3:*>---*^*}{0:¬} |
  637. {0:~ }|
  638. {0:~ }|
  639. {0:~ }|
  640. |
  641. ]])
  642. end)
  643. end)
  644. describe('CursorLine highlight', function()
  645. before_each(clear)
  646. it('overridden by Error, ColorColumn if fg not set', function()
  647. local screen = Screen.new(50,5)
  648. screen:set_default_attr_ids({
  649. [1] = {foreground = Screen.colors.SlateBlue},
  650. [2] = {bold = true, foreground = Screen.colors.Brown},
  651. [3] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
  652. [4] = {foreground = Screen.colors.SlateBlue, background = Screen.colors.Gray90},
  653. [5] = {background = Screen.colors.Gray90},
  654. [6] = {bold = true, foreground = Screen.colors.Blue1},
  655. [7] = {background = Screen.colors.LightRed},
  656. })
  657. screen:attach()
  658. command('filetype on')
  659. command('syntax on')
  660. command('set cursorline ft=json')
  661. feed('i{<cr>"a" : abc // 10;<cr>}<cr><esc>')
  662. screen:expect([[
  663. {1:{} |
  664. "{2:a}" : {3:abc} {3:// 10;} |
  665. {1:}} |
  666. {5:^ }|
  667. |
  668. ]])
  669. command('set colorcolumn=3')
  670. feed('i <esc>')
  671. screen:expect([[
  672. {1:{} {7: } |
  673. "{2:a}{7:"} : {3:abc} {3:// 10;} |
  674. {1:}} {7: } |
  675. {5: ^ }{7: }{5: }|
  676. |
  677. ]])
  678. end)
  679. it('with split-windows in diff-mode', function()
  680. local screen = Screen.new(50,12)
  681. screen:set_default_attr_ids({
  682. [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
  683. [2] = {bold = true, background = Screen.colors.Red},
  684. [3] = {background = Screen.colors.LightMagenta},
  685. [4] = {reverse = true},
  686. [5] = {background = Screen.colors.LightBlue},
  687. [6] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
  688. [7] = {background = Screen.colors.Red, foreground = Screen.colors.White},
  689. [8] = {bold = true, foreground = Screen.colors.Blue1},
  690. [9] = {bold = true, reverse = true},
  691. [10] = {bold = true},
  692. })
  693. screen:attach()
  694. command('hi CursorLine ctermbg=red ctermfg=white guibg=red guifg=white')
  695. command('set cursorline')
  696. feed('iline 1 some text<cr>line 2 more text<cr>extra line!<cr>extra line!<cr>last line ...<cr>')
  697. feed('<esc>gg')
  698. command('vsplit')
  699. command('enew')
  700. feed('iline 1 some text<cr>line 2 moRe text!<cr>extra line!<cr>extra line!<cr>extra line!<cr>last line ...<cr>')
  701. feed('<esc>gg')
  702. command('windo diffthis')
  703. screen:expect([[
  704. {1: }{7:line 1 some text }{4:│}{1: }{7:^line 1 some text }|
  705. {1: }{3:line 2 mo}{2:Re text!}{3: }{4:│}{1: }{3:line 2 mo}{2:re text}{3: }|
  706. {1: }{5:extra line! }{4:│}{1: }{6:----------------------}|
  707. {1: }extra line! {4:│}{1: }extra line! |
  708. {1: }extra line! {4:│}{1: }extra line! |
  709. {1: }last line ... {4:│}{1: }last line ... |
  710. {1: } {4:│}{1: } |
  711. {1: }{8:~ }{4:│}{1: }{8:~ }|
  712. {1: }{8:~ }{4:│}{1: }{8:~ }|
  713. {1: }{8:~ }{4:│}{1: }{8:~ }|
  714. {4:[No Name] [+] }{9:[No Name] [+] }|
  715. |
  716. ]])
  717. feed('jjjjj')
  718. screen:expect([[
  719. {1: }line 1 some text {4:│}{1: }line 1 some text |
  720. {1: }{3:line 2 mo}{2:Re text!}{3: }{4:│}{1: }{3:line 2 mo}{2:re text}{3: }|
  721. {1: }{5:extra line! }{4:│}{1: }{6:----------------------}|
  722. {1: }extra line! {4:│}{1: }extra line! |
  723. {1: }extra line! {4:│}{1: }extra line! |
  724. {1: }last line ... {4:│}{1: }last line ... |
  725. {1: }{7: }{4:│}{1: }{7:^ }|
  726. {1: }{8:~ }{4:│}{1: }{8:~ }|
  727. {1: }{8:~ }{4:│}{1: }{8:~ }|
  728. {1: }{8:~ }{4:│}{1: }{8:~ }|
  729. {4:[No Name] [+] }{9:[No Name] [+] }|
  730. |
  731. ]])
  732. -- CursorLine with fg=NONE is "low-priority".
  733. -- Rendered as underline in a diff-line. #9028
  734. command('hi CursorLine ctermbg=red ctermfg=NONE guibg=red guifg=NONE')
  735. feed('kkkk')
  736. screen:expect([[
  737. {1: }line 1 some text {4:│}{1: }line 1 some text |
  738. {1: }{11:line 2 mo}{12:Re text!}{11: }{4:│}{1: }{11:^line 2 mo}{12:re text}{11: }|
  739. {1: }{5:extra line! }{4:│}{1: }{6:----------------------}|
  740. {1: }extra line! {4:│}{1: }extra line! |
  741. {1: }extra line! {4:│}{1: }extra line! |
  742. {1: }last line ... {4:│}{1: }last line ... |
  743. {1: } {4:│}{1: } |
  744. {1: }{8:~ }{4:│}{1: }{8:~ }|
  745. {1: }{8:~ }{4:│}{1: }{8:~ }|
  746. {1: }{8:~ }{4:│}{1: }{8:~ }|
  747. {4:[No Name] [+] }{9:[No Name] [+] }|
  748. |
  749. ]], {
  750. [1] = {foreground = Screen.colors.DarkBlue, background = Screen.colors.WebGray},
  751. [2] = {bold = true, background = Screen.colors.Red},
  752. [3] = {background = Screen.colors.LightMagenta},
  753. [4] = {reverse = true},
  754. [5] = {background = Screen.colors.LightBlue},
  755. [6] = {background = Screen.colors.LightCyan1, bold = true, foreground = Screen.colors.Blue1},
  756. [7] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
  757. [8] = {bold = true, foreground = Screen.colors.Blue1},
  758. [9] = {bold = true, reverse = true},
  759. [10] = {bold = true},
  760. [11] = {underline = true,
  761. background = Screen.colors.LightMagenta},
  762. [12] = {bold = true, underline = true,
  763. background = Screen.colors.Red},
  764. })
  765. end)
  766. end)
  767. describe("MsgSeparator highlight and msgsep fillchar", function()
  768. before_each(clear)
  769. it("works", function()
  770. local screen = Screen.new(50,5)
  771. screen:set_default_attr_ids({
  772. [1] = {bold=true, foreground=Screen.colors.Blue},
  773. [2] = {bold=true, reverse=true},
  774. [3] = {bold = true, foreground = Screen.colors.SeaGreen4},
  775. [4] = {background = Screen.colors.Cyan, bold = true, reverse = true},
  776. [5] = {bold = true, background = Screen.colors.Magenta}
  777. })
  778. screen:attach()
  779. -- defaults
  780. feed_command("ls")
  781. screen:expect([[
  782. |
  783. {2: }|
  784. :ls |
  785. 1 %a "[No Name]" line 1 |
  786. {3:Press ENTER or type command to continue}^ |
  787. ]])
  788. feed('<cr>')
  789. feed_command("set fillchars+=msgsep:-")
  790. feed_command("ls")
  791. screen:expect([[
  792. |
  793. {2:--------------------------------------------------}|
  794. :ls |
  795. 1 %a "[No Name]" line 1 |
  796. {3:Press ENTER or type command to continue}^ |
  797. ]])
  798. -- linked to StatusLine per default
  799. feed_command("hi StatusLine guibg=Cyan")
  800. feed_command("ls")
  801. screen:expect([[
  802. |
  803. {4:--------------------------------------------------}|
  804. :ls |
  805. 1 %a "[No Name]" line 1 |
  806. {3:Press ENTER or type command to continue}^ |
  807. ]])
  808. -- but can be unlinked
  809. feed_command("hi clear MsgSeparator")
  810. feed_command("hi MsgSeparator guibg=Magenta gui=bold")
  811. feed_command("ls")
  812. screen:expect([[
  813. |
  814. {5:--------------------------------------------------}|
  815. :ls |
  816. 1 %a "[No Name]" line 1 |
  817. {3:Press ENTER or type command to continue}^ |
  818. ]])
  819. -- when display doesn't contain msgsep, these options have no effect
  820. feed_command("set display-=msgsep")
  821. feed_command("ls")
  822. screen:expect([[
  823. {1:~ }|
  824. {1:~ }|
  825. :ls |
  826. 1 %a "[No Name]" line 1 |
  827. {3:Press ENTER or type command to continue}^ |
  828. ]])
  829. end)
  830. end)
  831. describe("'winhighlight' highlight", function()
  832. local screen
  833. before_each(function()
  834. clear()
  835. screen = Screen.new(20,8)
  836. screen:attach()
  837. screen:set_default_attr_ids({
  838. [0] = {bold=true, foreground=Screen.colors.Blue},
  839. [1] = {background = Screen.colors.DarkBlue},
  840. [2] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Blue1},
  841. [3] = {bold = true, reverse = true},
  842. [4] = {reverse = true},
  843. [5] = {background = Screen.colors.DarkGreen},
  844. [6] = {background = Screen.colors.DarkGreen, bold = true, foreground = Screen.colors.Blue1},
  845. [7] = {background = Screen.colors.DarkMagenta},
  846. [8] = {background = Screen.colors.DarkMagenta, bold = true, foreground = Screen.colors.Blue1},
  847. [9] = {foreground = Screen.colors.Brown},
  848. [10] = {foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue},
  849. [11] = {background = Screen.colors.DarkBlue, bold = true, reverse = true},
  850. [12] = {background = Screen.colors.DarkGreen, reverse = true},
  851. [13] = {background = Screen.colors.Magenta4, reverse = true},
  852. [14] = {background = Screen.colors.DarkBlue, reverse = true},
  853. [15] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red},
  854. [16] = {foreground = Screen.colors.Blue1},
  855. [17] = {background = Screen.colors.LightRed},
  856. [18] = {background = Screen.colors.Gray90},
  857. [19] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray},
  858. [20] = {background = Screen.colors.LightGrey, underline = true},
  859. [21] = {bold = true},
  860. [22] = {bold = true, foreground = Screen.colors.SeaGreen4},
  861. [23] = {background = Screen.colors.LightMagenta},
  862. [24] = {background = Screen.colors.WebGray},
  863. [25] = {bold = true, foreground = Screen.colors.Green1},
  864. [26] = {background = Screen.colors.Red},
  865. [27] = {background = Screen.colors.DarkBlue, bold = true, foreground = Screen.colors.Green1},
  866. })
  867. command("hi Background1 guibg=DarkBlue")
  868. command("hi Background2 guibg=DarkGreen")
  869. end)
  870. it('works for background color', function()
  871. insert("aa")
  872. command("split")
  873. command("set winhl=Normal:Background1")
  874. screen:expect([[
  875. {1:a^a }|
  876. {2:~ }|
  877. {2:~ }|
  878. {3:[No Name] [+] }|
  879. aa |
  880. {0:~ }|
  881. {4:[No Name] [+] }|
  882. |
  883. ]])
  884. command("enew")
  885. screen:expect([[
  886. {1:^ }|
  887. {2:~ }|
  888. {2:~ }|
  889. {3:[No Name] }|
  890. aa |
  891. {0:~ }|
  892. {4:[No Name] [+] }|
  893. |
  894. ]])
  895. end)
  896. it('handles invalid values', function()
  897. command("set winhl=Normal:Background1")
  898. screen:expect([[
  899. {1:^ }|
  900. {2:~ }|
  901. {2:~ }|
  902. {2:~ }|
  903. {2:~ }|
  904. {2:~ }|
  905. {2:~ }|
  906. |
  907. ]])
  908. eq('Vim(set):E474: Invalid argument: winhl=xxx:yyy',
  909. exc_exec("set winhl=xxx:yyy"))
  910. eq('Normal:Background1', eval('&winhl'))
  911. screen:expect{grid=[[
  912. {1:^ }|
  913. {2:~ }|
  914. {2:~ }|
  915. {2:~ }|
  916. {2:~ }|
  917. {2:~ }|
  918. {2:~ }|
  919. |
  920. ]], unchanged=true}
  921. end)
  922. it('works local to the buffer', function()
  923. insert("aa")
  924. command("split")
  925. command("setlocal winhl=Normal:Background1")
  926. screen:expect([[
  927. {1:a^a }|
  928. {2:~ }|
  929. {2:~ }|
  930. {3:[No Name] [+] }|
  931. aa |
  932. {0:~ }|
  933. {4:[No Name] [+] }|
  934. |
  935. ]])
  936. command("enew")
  937. screen:expect([[
  938. ^ |
  939. {0:~ }|
  940. {0:~ }|
  941. {3:[No Name] }|
  942. aa |
  943. {0:~ }|
  944. {4:[No Name] [+] }|
  945. |
  946. ]])
  947. command("bnext")
  948. screen:expect([[
  949. {1:^aa }|
  950. {2:~ }|
  951. {2:~ }|
  952. {3:[No Name] [+] }|
  953. aa |
  954. {0:~ }|
  955. {4:[No Name] [+] }|
  956. |
  957. ]])
  958. end)
  959. it('for inactive window background works', function()
  960. command("set winhl=Normal:Background1,NormalNC:Background2")
  961. -- tests global value is copied across split
  962. command("split")
  963. screen:expect([[
  964. {1:^ }|
  965. {2:~ }|
  966. {2:~ }|
  967. {3:[No Name] }|
  968. {5: }|
  969. {6:~ }|
  970. {4:[No Name] }|
  971. |
  972. ]])
  973. feed("<c-w><c-w>")
  974. screen:expect([[
  975. {5: }|
  976. {6:~ }|
  977. {6:~ }|
  978. {4:[No Name] }|
  979. {1:^ }|
  980. {2:~ }|
  981. {3:[No Name] }|
  982. |
  983. ]])
  984. feed("<c-w><c-w>")
  985. screen:expect([[
  986. {1:^ }|
  987. {2:~ }|
  988. {2:~ }|
  989. {3:[No Name] }|
  990. {5: }|
  991. {6:~ }|
  992. {4:[No Name] }|
  993. |
  994. ]])
  995. end)
  996. it('works with NormalNC', function()
  997. command("hi NormalNC guibg=DarkMagenta")
  998. -- tests global value is copied across split
  999. command("split")
  1000. screen:expect([[
  1001. ^ |
  1002. {0:~ }|
  1003. {0:~ }|
  1004. {3:[No Name] }|
  1005. {7: }|
  1006. {8:~ }|
  1007. {4:[No Name] }|
  1008. |
  1009. ]])
  1010. command("wincmd w")
  1011. screen:expect([[
  1012. {7: }|
  1013. {8:~ }|
  1014. {8:~ }|
  1015. {4:[No Name] }|
  1016. ^ |
  1017. {0:~ }|
  1018. {3:[No Name] }|
  1019. |
  1020. ]])
  1021. -- winbg=Normal:... overrides global NormalNC
  1022. command("set winhl=Normal:Background1")
  1023. screen:expect([[
  1024. {7: }|
  1025. {8:~ }|
  1026. {8:~ }|
  1027. {4:[No Name] }|
  1028. {1:^ }|
  1029. {2:~ }|
  1030. {3:[No Name] }|
  1031. |
  1032. ]])
  1033. command("wincmd w")
  1034. screen:expect([[
  1035. ^ |
  1036. {0:~ }|
  1037. {0:~ }|
  1038. {3:[No Name] }|
  1039. {1: }|
  1040. {2:~ }|
  1041. {4:[No Name] }|
  1042. |
  1043. ]])
  1044. command("wincmd w")
  1045. command("set winhl=Normal:Background1,NormalNC:Background2")
  1046. screen:expect([[
  1047. {7: }|
  1048. {8:~ }|
  1049. {8:~ }|
  1050. {4:[No Name] }|
  1051. {1:^ }|
  1052. {2:~ }|
  1053. {3:[No Name] }|
  1054. |
  1055. ]])
  1056. command("wincmd w")
  1057. screen:expect([[
  1058. ^ |
  1059. {0:~ }|
  1060. {0:~ }|
  1061. {3:[No Name] }|
  1062. {5: }|
  1063. {6:~ }|
  1064. {4:[No Name] }|
  1065. |
  1066. ]])
  1067. end)
  1068. it('background applies also to non-text', function()
  1069. command('set sidescroll=0')
  1070. insert('Lorem ipsum dolor sit amet ')
  1071. command('set shiftwidth=2')
  1072. feed('>>')
  1073. command('set number')
  1074. command('set breakindent')
  1075. command('set briopt=shift:5,min:0')
  1076. command('set list')
  1077. command('set showbreak=↪')
  1078. screen:expect([[
  1079. {9: 1 } ^Lorem ipsum do|
  1080. {9: } {0:↪}lor sit |
  1081. {9: } {0:↪}amet{0:-} |
  1082. {0:~ }|
  1083. {0:~ }|
  1084. {0:~ }|
  1085. {0:~ }|
  1086. |
  1087. ]])
  1088. command('set winhl=Normal:Background1')
  1089. screen:expect([[
  1090. {10: 1 }{1: ^Lorem ipsum do}|
  1091. {10: }{1: }{2:↪}{1:lor sit }|
  1092. {10: }{1: }{2:↪}{1:amet}{2:-}{1: }|
  1093. {2:~ }|
  1094. {2:~ }|
  1095. {2:~ }|
  1096. {2:~ }|
  1097. |
  1098. ]])
  1099. command('set nowrap')
  1100. command('set listchars+=extends:❯,precedes:❮')
  1101. feed('3w')
  1102. screen:expect([[
  1103. {10: 1 }{2:❮}{1: dolor ^sit ame}{2:❯}|
  1104. {2:~ }|
  1105. {2:~ }|
  1106. {2:~ }|
  1107. {2:~ }|
  1108. {2:~ }|
  1109. {2:~ }|
  1110. |
  1111. ]])
  1112. end)
  1113. it("background doesn't override syntax background", function()
  1114. command('syntax on')
  1115. command('syntax keyword Foobar foobar')
  1116. command('syntax keyword Article the')
  1117. command('hi Foobar guibg=#FF0000')
  1118. command('hi Article guifg=#00FF00 gui=bold')
  1119. insert('the foobar was foobar')
  1120. screen:expect([[
  1121. {25:the} {26:foobar} was {26:fooba}|
  1122. {26:^r} |
  1123. {0:~ }|
  1124. {0:~ }|
  1125. {0:~ }|
  1126. {0:~ }|
  1127. {0:~ }|
  1128. |
  1129. ]])
  1130. -- winhl=Normal:Group with background doesn't override syntax background,
  1131. -- but does combine with syntax foreground.
  1132. command('set winhl=Normal:Background1')
  1133. screen:expect([[
  1134. {27:the}{1: }{26:foobar}{1: was }{26:fooba}|
  1135. {26:^r}{1: }|
  1136. {2:~ }|
  1137. {2:~ }|
  1138. {2:~ }|
  1139. {2:~ }|
  1140. {2:~ }|
  1141. |
  1142. ]])
  1143. end)
  1144. it('can override NonText, Conceal and EndOfBuffer', function()
  1145. curbufmeths.set_lines(0,-1,true, {"raa\000"})
  1146. command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
  1147. command('set cole=2 cocu=nvic')
  1148. command('split')
  1149. command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})')
  1150. command('set winhl=SpecialKey:ErrorMsg,EndOfBuffer:Background1,'
  1151. ..'Conceal:Background2')
  1152. screen:expect([[
  1153. ^r{5:#}a{15:^@} |
  1154. {1:~ }|
  1155. {1:~ }|
  1156. {3:[No Name] [+] }|
  1157. r{19:#}a{16:^@} |
  1158. {0:~ }|
  1159. {4:[No Name] [+] }|
  1160. |
  1161. ]])
  1162. end)
  1163. it('can override LineNr, CursorColumn and ColorColumn', function()
  1164. insert('very text\nmore text')
  1165. command('set number')
  1166. command('set colorcolumn=2')
  1167. command('set cursorcolumn')
  1168. command('split')
  1169. command('set winhl=LineNr:Background1,CursorColumn:Background2,'
  1170. ..'ColorColumn:ErrorMsg')
  1171. screen:expect([[
  1172. {1: 1 }v{15:e}ry tex{5:t} |
  1173. {1: 2 }m{15:o}re tex^t |
  1174. {0:~ }|
  1175. {3:[No Name] [+] }|
  1176. {9: 1 }v{17:e}ry tex{18:t} |
  1177. {9: 2 }m{17:o}re text |
  1178. {4:[No Name] [+] }|
  1179. |
  1180. ]])
  1181. end)
  1182. it('can override Tabline', function()
  1183. command('tabnew')
  1184. command('set winhl=TabLine:Background1,TabLineSel:ErrorMsg')
  1185. screen:expect([[
  1186. {20: No Name] }{15: No Name]}{20:X}|
  1187. ^ |
  1188. {0:~ }|
  1189. {0:~ }|
  1190. {0:~ }|
  1191. {0:~ }|
  1192. {0:~ }|
  1193. |
  1194. ]])
  1195. command("tabnext")
  1196. screen:expect([[
  1197. {21: No Name] }{1: No Name]}{20:X}|
  1198. ^ |
  1199. {0:~ }|
  1200. {0:~ }|
  1201. {0:~ }|
  1202. {0:~ }|
  1203. {0:~ }|
  1204. |
  1205. ]])
  1206. end)
  1207. it('can override popupmenu', function()
  1208. insert('word wording wordy')
  1209. command('split')
  1210. command('set winhl=Pmenu:Background1,PmenuSel:Background2,'
  1211. ..'PmenuSbar:ErrorMsg,PmenuThumb:Normal')
  1212. screen:expect([[
  1213. word wording word^y |
  1214. {0:~ }|
  1215. {0:~ }|
  1216. {3:[No Name] [+] }|
  1217. word wording wordy |
  1218. {0:~ }|
  1219. {4:[No Name] [+] }|
  1220. |
  1221. ]])
  1222. feed('oword<c-x><c-p>')
  1223. screen:expect([[
  1224. word wording wordy |
  1225. wordy^ |
  1226. {1:word }{0: }|
  1227. {1:wording }{3: }|
  1228. {5:wordy }rdy |
  1229. wordy |
  1230. {4:[No Name] [+] }|
  1231. {21:-- }{22:match 1 of 3} |
  1232. ]])
  1233. feed('<esc>u<c-w><c-w>oword<c-x><c-p>')
  1234. screen:expect([[
  1235. word wording wordy |
  1236. wordy |
  1237. {23:word }{0: }|
  1238. {23:wording }{4: }|
  1239. {24:wordy }rdy |
  1240. wordy^ |
  1241. {3:[No Name] [+] }|
  1242. {21:-- }{22:match 1 of 3} |
  1243. ]])
  1244. end)
  1245. end)