mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	Merge pull request #17335 from famiu/fix/ui/win-resize
fix: Make window resize commands manage cmdheight
This commit is contained in:
		@@ -5412,11 +5412,17 @@ void win_setheight_win(int height, win_T *win)
 | 
			
		||||
    // line, clear it.
 | 
			
		||||
    if (full_screen && msg_scrolled == 0 && row < cmdline_row) {
 | 
			
		||||
      grid_fill(&default_grid, row, cmdline_row, 0, Columns, ' ', ' ', 0);
 | 
			
		||||
      if (msg_grid.chars) {
 | 
			
		||||
        clear_cmdline = true;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    cmdline_row = row;
 | 
			
		||||
    p_ch = MAX(Rows - cmdline_row, 1);
 | 
			
		||||
    curtab->tp_ch_used = p_ch;
 | 
			
		||||
    msg_row = row;
 | 
			
		||||
    msg_col = 0;
 | 
			
		||||
    redraw_all_later(NOT_VALID);
 | 
			
		||||
    showmode();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -5452,7 +5458,9 @@ static void frame_setheight(frame_T *curfrp, int height)
 | 
			
		||||
  if (curfrp->fr_parent == NULL) {
 | 
			
		||||
    // topframe: can only change the command line
 | 
			
		||||
    if (height > ROWS_AVAIL) {
 | 
			
		||||
      height = ROWS_AVAIL;
 | 
			
		||||
      // If height is greater than the available space, try to create space for the frame by
 | 
			
		||||
      // reducing 'cmdheight' if possible, while making sure `cmdheight` doesn't go below 1.
 | 
			
		||||
      height = MIN(ROWS_AVAIL + (p_ch - 1), height);
 | 
			
		||||
    }
 | 
			
		||||
    if (height > 0) {
 | 
			
		||||
      frame_new_height(curfrp, height, false, false);
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,15 @@ describe('cmdline', function()
 | 
			
		||||
  it('is cleared when switching tabs', function()
 | 
			
		||||
    local screen = Screen.new(30, 10)
 | 
			
		||||
    screen:attach()
 | 
			
		||||
    screen:set_default_attr_ids {
 | 
			
		||||
      [1] = {underline = true, background = Screen.colors.LightGrey};
 | 
			
		||||
      [2] = {bold = true};
 | 
			
		||||
      [3] = {reverse = true};
 | 
			
		||||
      [4] = {bold = true, foreground = Screen.colors.Blue1};
 | 
			
		||||
    }
 | 
			
		||||
    -- TODO(bfredl): redraw with tabs is severly broken. fix it
 | 
			
		||||
    feed_command [[ set display-=msgsep ]]
 | 
			
		||||
 | 
			
		||||
    feed_command([[call setline(1, range(30))]])
 | 
			
		||||
    screen:expect([[
 | 
			
		||||
      ^0                             |
 | 
			
		||||
@@ -24,18 +33,61 @@ describe('cmdline', function()
 | 
			
		||||
      8                             |
 | 
			
		||||
      :call setline(1, range(30))   |
 | 
			
		||||
    ]])
 | 
			
		||||
    feed([[:tabnew<cr><C-w>-<C-w>-gtgt]])
 | 
			
		||||
    screen:expect([[
 | 
			
		||||
       + [No Name]  [No Name]      X|
 | 
			
		||||
 | 
			
		||||
    feed [[:tabnew<cr>]]
 | 
			
		||||
    screen:expect{grid=[[
 | 
			
		||||
      {1: + [No Name] }{2: [No Name] }{3:     }{1:X}|
 | 
			
		||||
      ^                              |
 | 
			
		||||
      ~                             |
 | 
			
		||||
      ~                             |
 | 
			
		||||
      ~                             |
 | 
			
		||||
      ~                             |
 | 
			
		||||
      ~                             |
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      :tabnew                       |
 | 
			
		||||
    ]]}
 | 
			
		||||
 | 
			
		||||
    feed [[<C-w>-<C-w>-]]
 | 
			
		||||
    screen:expect{grid=[[
 | 
			
		||||
      {1: + [No Name] }{2: [No Name] }{3:     }{1:X}|
 | 
			
		||||
      ^                              |
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
                                    |
 | 
			
		||||
                                    |
 | 
			
		||||
      :tabnew                       |
 | 
			
		||||
    ]]}
 | 
			
		||||
 | 
			
		||||
    feed [[gt]]
 | 
			
		||||
    screen:expect{grid=[[
 | 
			
		||||
      {2: + [No Name] }{1: [No Name] }{3:     }{1:X}|
 | 
			
		||||
      ^0                             |
 | 
			
		||||
      1                             |
 | 
			
		||||
      2                             |
 | 
			
		||||
      3                             |
 | 
			
		||||
      4                             |
 | 
			
		||||
      5                             |
 | 
			
		||||
      6                             |
 | 
			
		||||
      7                             |
 | 
			
		||||
                                    |
 | 
			
		||||
    ]]}
 | 
			
		||||
 | 
			
		||||
    feed [[gt]]
 | 
			
		||||
    screen:expect([[
 | 
			
		||||
      {1: + [No Name] }{2: [No Name] }{3:     }{1:X}|
 | 
			
		||||
      ^                              |
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
      {4:~                             }|
 | 
			
		||||
                                    |
 | 
			
		||||
                                    |
 | 
			
		||||
                                    |
 | 
			
		||||
    ]])
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user