From 4c6626f03dc645a426c1e63ca372b96f1073581b Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Mon, 23 May 2022 19:11:24 +0600 Subject: feat: click support for 'statusline', 'winbar' #18650 The mouseclick item "%@" is now supported by 'statusline' and 'winbar'. Previously it was only supported by 'tabline'. --- test/functional/ui/global_statusline_spec.lua | 260 --------------------- test/functional/ui/statusline_spec.lua | 317 ++++++++++++++++++++++++++ 2 files changed, 317 insertions(+), 260 deletions(-) delete mode 100644 test/functional/ui/global_statusline_spec.lua create mode 100644 test/functional/ui/statusline_spec.lua (limited to 'test/functional') diff --git a/test/functional/ui/global_statusline_spec.lua b/test/functional/ui/global_statusline_spec.lua deleted file mode 100644 index 369c4a31f1..0000000000 --- a/test/functional/ui/global_statusline_spec.lua +++ /dev/null @@ -1,260 +0,0 @@ -local helpers = require('test.functional.helpers')(after_each) -local Screen = require('test.functional.ui.screen') -local clear, command, feed = helpers.clear, helpers.command, helpers.feed -local eq, funcs, meths = helpers.eq, helpers.funcs, helpers.meths - -describe('global statusline', function() - local screen - - before_each(function() - clear() - screen = Screen.new(60, 16) - screen:attach() - command('set laststatus=3') - command('set ruler') - end) - - it('works', function() - screen:expect{grid=[[ - ^ | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {2:[No Name] 0,0-1 All}| - | - ]], attr_ids={ - [1] = {bold = true, foreground = Screen.colors.Blue1}; - [2] = {bold = true, reverse = true}; - }} - - feed('i') - screen:expect{grid=[[ - | - | - ^ | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {2:[No Name] [+] 3,1 All}| - {3:-- INSERT --} | - ]], attr_ids={ - [1] = {bold = true, foreground = Screen.colors.Blue}; - [2] = {bold = true, reverse = true}; - [3] = {bold = true}; - }} - end) - - it('works with splits', function() - command('vsplit | split | vsplit | vsplit | wincmd l | split | 2wincmd l | split') - screen:expect{grid=[[ - │ │ │^ | - {2:~ }│{2:~ }│{2:~}│{2:~ }| - {2:~ }│{2:~ }│{2:~}│{2:~ }| - {2:~ }│{2:~ }│{2:~}│{2:~ }| - {2:~ }├────────────────┤{2:~}│{2:~ }| - {2:~ }│ │{2:~}│{2:~ }| - {2:~ }│{2:~ }│{2:~}│{2:~ }| - {2:~ }│{2:~ }│{2:~}├────────────────────| - {2:~ }│{2:~ }│{2:~}│ | - ────────────────────┴────────────────┴─┤{2:~ }| - │{2:~ }| - {2:~ }│{2:~ }| - {2:~ }│{2:~ }| - {2:~ }│{2:~ }| - {3:[No Name] 0,0-1 All}| - | - ]], attr_ids={ - [1] = {reverse = true}; - [2] = {bold = true, foreground = Screen.colors.Blue1}; - [3] = {bold = true, reverse = true}; - }} - end) - - it('works when switching between values of laststatus', function() - command('set laststatus=1') - screen:expect{grid=[[ - ^ | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - 0,0-1 All | - ]], attr_ids={ - [1] = {foreground = Screen.colors.Blue, bold = true}; - }} - - command('set laststatus=3') - screen:expect{grid=[[ - ^ | - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {1:~ }| - {2:[No Name] 0,0-1 All}| - | - ]], attr_ids={ - [1] = {foreground = Screen.colors.Blue, bold = true}; - [2] = {reverse = true, bold = true}; - }} - - command('vsplit | split | vsplit | vsplit | wincmd l | split | 2wincmd l | split') - command('set laststatus=2') - screen:expect{grid=[[ - │ │ │^ | - {2:~ }│{2:~ }│{2:~}│{2:~ }| - {2:~ }│{2:~ }│{2:~}│{2:~ }| - {2:~ }│{2:~ }│{2:~}│{2:~ }| - {2:~ }│{1:< Name] 0,0-1 }│{2:~}│{2:~ }| - {2:~ }│ │{2:~}│{2:~ }| - {2:~ }│{2:~ }│{2:~}│{2:~ }| - {2:~ }│{2:~ }│{2:~}│{3:') + screen:expect([[ + | + | + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:[No Name] [+] 3,1 All}| + {3:-- INSERT --} | + ]]) + end) + + it('works with splits', function() + command('vsplit | split | vsplit | vsplit | wincmd l | split | 2wincmd l | split') + screen:expect([[ + │ │ │^ | + {1:~ }│{1:~ }│{1:~}│{1:~ }| + {1:~ }│{1:~ }│{1:~}│{1:~ }| + {1:~ }│{1:~ }│{1:~}│{1:~ }| + {1:~ }├────────────────┤{1:~}│{1:~ }| + {1:~ }│ │{1:~}│{1:~ }| + {1:~ }│{1:~ }│{1:~}│{1:~ }| + {1:~ }│{1:~ }│{1:~}├────────────────────| + {1:~ }│{1:~ }│{1:~}│ | + ────────────────────┴────────────────┴─┤{1:~ }| + │{1:~ }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {1:~ }│{1:~ }| + {2:[No Name] 0,0-1 All}| + | + ]]) + end) + + it('works when switching between values of laststatus', function() + command('set laststatus=1') + screen:expect([[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + 0,0-1 All | + ]]) + + command('set laststatus=3') + screen:expect([[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:[No Name] 0,0-1 All}| + | + ]]) + + command('vsplit | split | vsplit | vsplit | wincmd l | split | 2wincmd l | split') + command('set laststatus=2') + screen:expect([[ + │ │ │^ | + {1:~ }│{1:~ }│{1:~}│{1:~ }| + {1:~ }│{1:~ }│{1:~}│{1:~ }| + {1:~ }│{1:~ }│{1:~}│{1:~ }| + {1:~ }│{4:< Name] 0,0-1 }│{1:~}│{1:~ }| + {1:~ }│ │{1:~}│{1:~ }| + {1:~ }│{1:~ }│{1:~}│{1:~ }| + {1:~ }│{1:~ }│{1:~}│{2: