diff options
| author | sach1t <sach0010t@gmail.com> | 2016-06-04 01:37:32 -0400 | 
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2016-09-12 03:11:26 +0200 | 
| commit | c6f5d6b7e0f274a245cecd80c480212d399df9d4 (patch) | |
| tree | 2206d2bdac910524164179169bc30087d6c2c5b8 /test/functional/ui/mouse_spec.lua | |
| parent | 4ceacb37d52289df609a23ecfa8130682e0d55e5 (diff) | |
| download | rneovim-c6f5d6b7e0f274a245cecd80c480212d399df9d4.tar.gz rneovim-c6f5d6b7e0f274a245cecd80c480212d399df9d4.tar.bz2 rneovim-c6f5d6b7e0f274a245cecd80c480212d399df9d4.zip | |
normal.c: Restore vim-like tab dragging. #4874
Closes #4663
References #3310
Diffstat (limited to 'test/functional/ui/mouse_spec.lua')
| -rw-r--r-- | test/functional/ui/mouse_spec.lua | 216 | 
1 files changed, 216 insertions, 0 deletions
| diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index 041e9338b1..388d84fba6 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -111,6 +111,222 @@ describe('Mouse input', function()      ]])    end) +  describe('tab drag', function() +    before_each(function() +      screen:set_default_attr_ids( { +        [0] = {bold=true, foreground=Screen.colors.Blue}, +        tab  = { background=Screen.colors.LightGrey, underline=true }, +        sel  = { bold=true }, +        fill = { reverse=true } +      }) +      screen.timeout = 15000 +    end) + +    it('in tabline on filler space moves tab to the end', function() +      execute('%delete') +      insert('this is foo') +      execute('silent file foo | tabnew | file bar') +      insert('this is bar') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftMouse><4,0>') +      screen:expect([[ +        {sel: + foo }{tab: + bar }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><14,0>') +      screen:expect([[ +        {tab: + bar }{sel: + foo }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +    end) + +    it('in tabline to the left moves tab left', function() +      execute('%delete') +      insert('this is foo') +      execute('silent file foo | tabnew | file bar') +      insert('this is bar') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftMouse><11,0>') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><6,0>') +      screen:expect([[ +        {sel: + bar }{tab: + foo }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +    end) + +    it('in tabline to the right moves tab right', function() +      execute('%delete') +      insert('this is foo') +      execute('silent file foo | tabnew | file bar') +      insert('this is bar') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftMouse><4,0>') +      screen:expect([[ +        {sel: + foo }{tab: + bar }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><7,0>') +      screen:expect([[ +        {tab: + bar }{sel: + foo }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +    end) + +    it('out of tabline under filler space moves tab to the end', function() +      execute('%delete') +      insert('this is foo') +      execute('silent file foo | tabnew | file bar') +      insert('this is bar') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftMouse><4,0>') +      screen:expect([[ +        {sel: + foo }{tab: + bar }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><4,1>') +      screen:expect([[ +        {sel: + foo }{tab: + bar }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><14,1>') +      screen:expect([[ +        {tab: + bar }{sel: + foo }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +    end) + +    it('out of tabline to the left moves tab left', function() +      execute('%delete') +      insert('this is foo') +      execute('silent file foo | tabnew | file bar') +      insert('this is bar') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftMouse><11,0>') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><11,1>') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><6,1>') +      screen:expect([[ +        {sel: + bar }{tab: + foo }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +    end) + +    it('out of tabline to the right moves tab right', function() +      execute('%delete') +      insert('this is foo') +      execute('silent file foo | tabnew | file bar') +      insert('this is bar') +      screen:expect([[ +        {tab: + foo }{sel: + bar }{fill:          }{tab:X}| +        this is ba^r              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftMouse><4,0>') +      screen:expect([[ +        {sel: + foo }{tab: + bar }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><4,1>') +      screen:expect([[ +        {sel: + foo }{tab: + bar }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +      feed('<LeftDrag><7,1>') +      screen:expect([[ +        {tab: + bar }{sel: + foo }{fill:          }{tab:X}| +        this is fo^o              | +        {0:~                        }| +        {0:~                        }| +                                 | +      ]]) +    end) +  end) +    describe('tabline', function()      before_each(function()        screen:set_default_attr_ids( { | 
