quickfix_spec.lua 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. local helpers = require('test.functional.helpers')(after_each)
  2. local Screen = require('test.functional.ui.screen')
  3. local clear, feed, meths = helpers.clear, helpers.feed, helpers.meths
  4. local insert, command = helpers.insert, helpers.command
  5. describe('quickfix selection highlight', function()
  6. local screen
  7. before_each(function()
  8. clear()
  9. screen = Screen.new(25, 10)
  10. screen:attach()
  11. screen:set_default_attr_ids({
  12. [1] = { bold = true, foreground = Screen.colors.Blue },
  13. [2] = {reverse = true},
  14. [3] = {foreground = Screen.colors.Brown},
  15. [4] = {bold = true, reverse = true},
  16. [5] = {background = Screen.colors.Green},
  17. [6] = {foreground = Screen.colors.Brown, background = Screen.colors.Green},
  18. [7] = {background = Screen.colors.Red},
  19. [8] = {foreground = Screen.colors.Brown, background = Screen.colors.Red},
  20. [9] = {background = Screen.colors.Fuchsia},
  21. [10] = {foreground = Screen.colors.Red, background = Screen.colors.Fuchsia},
  22. [11] = {foreground = Screen.colors.Red},
  23. [12] = {foreground = Screen.colors.Brown, background = Screen.colors.Fuchsia},
  24. })
  25. meths.set_option('errorformat', '%m %l')
  26. command('syntax on')
  27. command('highlight Search guibg=Green')
  28. insert([[
  29. Line 1
  30. Line 2
  31. Line 3
  32. Line 4
  33. Line 5
  34. ]])
  35. command('cad')
  36. feed('gg')
  37. screen:expect([[
  38. ^Line 1 |
  39. Line 2 |
  40. Line 3 |
  41. Line 4 |
  42. Line 5 |
  43. |
  44. {1:~ }|
  45. {1:~ }|
  46. {1:~ }|
  47. |
  48. ]])
  49. end)
  50. it('using default Search highlight group', function()
  51. command('copen')
  52. screen:expect([[
  53. Line 1 |
  54. {2:[No Name] [+] }|
  55. {5:^|}{6:1}{5:| Line }|
  56. |{3:2}| Line |
  57. |{3:3}| Line |
  58. |{3:4}| Line |
  59. |{3:5}| Line |
  60. || |
  61. {4:[Quickfix List] }|
  62. |
  63. ]])
  64. command('cnext')
  65. screen:expect([[
  66. Line 1 |
  67. {2:[No Name] [+] }|
  68. |{3:1}| Line |
  69. {5:^|}{6:2}{5:| Line }|
  70. |{3:3}| Line |
  71. |{3:4}| Line |
  72. |{3:5}| Line |
  73. || |
  74. {4:[Quickfix List] }|
  75. |
  76. ]])
  77. end)
  78. it('using QuickFixLine highlight group', function()
  79. command('highlight QuickFixLine guibg=Red')
  80. command('copen')
  81. screen:expect([[
  82. Line 1 |
  83. {2:[No Name] [+] }|
  84. {7:^|}{8:1}{7:| Line }|
  85. |{3:2}| Line |
  86. |{3:3}| Line |
  87. |{3:4}| Line |
  88. |{3:5}| Line |
  89. || |
  90. {4:[Quickfix List] }|
  91. |
  92. ]])
  93. command('cnext')
  94. screen:expect([[
  95. Line 1 |
  96. {2:[No Name] [+] }|
  97. |{3:1}| Line |
  98. {7:^|}{8:2}{7:| Line }|
  99. |{3:3}| Line |
  100. |{3:4}| Line |
  101. |{3:5}| Line |
  102. || |
  103. {4:[Quickfix List] }|
  104. |
  105. ]])
  106. end)
  107. it('combines with CursorLine', function()
  108. command('set cursorline')
  109. command('highlight QuickFixLine guifg=Red')
  110. command('highlight CursorLine guibg=Fuchsia')
  111. command('copen')
  112. screen:expect([[
  113. {9:Line 1 }|
  114. {2:[No Name] [+] }|
  115. {10:^|1| Line }|
  116. |{3:2}| Line |
  117. |{3:3}| Line |
  118. |{3:4}| Line |
  119. |{3:5}| Line |
  120. || |
  121. {4:[Quickfix List] }|
  122. |
  123. ]])
  124. feed('j')
  125. screen:expect([[
  126. {9:Line 1 }|
  127. {2:[No Name] [+] }|
  128. {11:|1| Line }|
  129. {9:^|}{12:2}{9:| Line }|
  130. |{3:3}| Line |
  131. |{3:4}| Line |
  132. |{3:5}| Line |
  133. || |
  134. {4:[Quickfix List] }|
  135. |
  136. ]])
  137. end)
  138. it('QuickFixLine background takes precedence over CursorLine', function()
  139. command('set cursorline')
  140. command('highlight QuickFixLine guibg=Red')
  141. command('highlight CursorLine guibg=Fuchsia')
  142. command('copen')
  143. screen:expect([[
  144. {9:Line 1 }|
  145. {2:[No Name] [+] }|
  146. {7:^|}{8:1}{7:| Line }|
  147. |{3:2}| Line |
  148. |{3:3}| Line |
  149. |{3:4}| Line |
  150. |{3:5}| Line |
  151. || |
  152. {4:[Quickfix List] }|
  153. |
  154. ]])
  155. feed('j')
  156. screen:expect([[
  157. {9:Line 1 }|
  158. {2:[No Name] [+] }|
  159. {7:|}{8:1}{7:| Line }|
  160. {9:^|}{12:2}{9:| Line }|
  161. |{3:3}| Line |
  162. |{3:4}| Line |
  163. |{3:5}| Line |
  164. || |
  165. {4:[Quickfix List] }|
  166. |
  167. ]])
  168. end)
  169. end)