mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-03 17:24:29 +00:00 
			
		
		
		
	test(ui/float_spec): click in bordered float sets correct curswant
This commit is contained in:
		@@ -8764,6 +8764,75 @@ describe('float window', function()
 | 
			
		||||
      end
 | 
			
		||||
    end)
 | 
			
		||||
 | 
			
		||||
    it('left click sets correct curswant in float window with border', function()
 | 
			
		||||
      local buf = meths.create_buf(false,false)
 | 
			
		||||
      meths.buf_set_lines(buf, 0, -1, true, {'', '', ''})
 | 
			
		||||
      meths.open_win(buf, false, {relative='editor', width=20, height=3, row=0, col=5, border='single'})
 | 
			
		||||
      if multigrid then
 | 
			
		||||
        screen:expect{grid=[[
 | 
			
		||||
        ## grid 1
 | 
			
		||||
          [2:----------------------------------------]|
 | 
			
		||||
          [2:----------------------------------------]|
 | 
			
		||||
          [2:----------------------------------------]|
 | 
			
		||||
          [2:----------------------------------------]|
 | 
			
		||||
          [2:----------------------------------------]|
 | 
			
		||||
          [2:----------------------------------------]|
 | 
			
		||||
          [3:----------------------------------------]|
 | 
			
		||||
        ## grid 2
 | 
			
		||||
          ^                                        |
 | 
			
		||||
          {0:~                                       }|
 | 
			
		||||
          {0:~                                       }|
 | 
			
		||||
          {0:~                                       }|
 | 
			
		||||
          {0:~                                       }|
 | 
			
		||||
          {0:~                                       }|
 | 
			
		||||
        ## grid 3
 | 
			
		||||
                                                  |
 | 
			
		||||
        ## grid 4
 | 
			
		||||
          {5:┌────────────────────┐}|
 | 
			
		||||
          {5:│}{1:                    }{5:│}|
 | 
			
		||||
          {5:│}{1:                    }{5:│}|
 | 
			
		||||
          {5:│}{1:                    }{5:│}|
 | 
			
		||||
          {5:└────────────────────┘}|
 | 
			
		||||
        ]], float_pos={
 | 
			
		||||
          [4] = {{id = 1001}, "NW", 1, 0, 5, true, 50};
 | 
			
		||||
        }, win_viewport={
 | 
			
		||||
          [2] = {win = {id = 1000}, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0};
 | 
			
		||||
          [4] = {win = {id = 1001}, topline = 0, botline = 3, curline = 0, curcol = 0, linecount = 3, sum_scroll_delta = 0};
 | 
			
		||||
        }}
 | 
			
		||||
      else
 | 
			
		||||
        screen:expect{grid=[[
 | 
			
		||||
          ^     {5:┌────────────────────┐}             |
 | 
			
		||||
          {0:~    }{5:│}{1:                    }{5:│}{0:             }|
 | 
			
		||||
          {0:~    }{5:│}{1:                    }{5:│}{0:             }|
 | 
			
		||||
          {0:~    }{5:│}{1:                    }{5:│}{0:             }|
 | 
			
		||||
          {0:~    }{5:└────────────────────┘}{0:             }|
 | 
			
		||||
          {0:~                                       }|
 | 
			
		||||
                                                  |
 | 
			
		||||
        ]]}
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      if multigrid then
 | 
			
		||||
        meths.input_mouse('left', 'press', '', 4, 3, 1)
 | 
			
		||||
      else
 | 
			
		||||
        meths.input_mouse('left', 'press', '', 0, 3, 6)
 | 
			
		||||
      end
 | 
			
		||||
      eq({0, 3, 1, 0, 1}, funcs.getcurpos())
 | 
			
		||||
 | 
			
		||||
      if multigrid then
 | 
			
		||||
        meths.input_mouse('left', 'press', '', 4, 3, 2)
 | 
			
		||||
      else
 | 
			
		||||
        meths.input_mouse('left', 'press', '', 0, 3, 7)
 | 
			
		||||
      end
 | 
			
		||||
      eq({0, 3, 1, 0, 2}, funcs.getcurpos())
 | 
			
		||||
 | 
			
		||||
      if multigrid then
 | 
			
		||||
        meths.input_mouse('left', 'press', '', 4, 3, 10)
 | 
			
		||||
      else
 | 
			
		||||
        meths.input_mouse('left', 'press', '', 0, 3, 15)
 | 
			
		||||
      end
 | 
			
		||||
      eq({0, 3, 1, 0, 10}, funcs.getcurpos())
 | 
			
		||||
    end)
 | 
			
		||||
 | 
			
		||||
    it("'winblend' option", function()
 | 
			
		||||
      screen:try_resize(50,9)
 | 
			
		||||
      screen:set_default_attr_ids({
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user