mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	fix(api): reconfiguring float "relative" does not clear "win" (#34271)
Problem:  Unable to change the "relative" of a flag after its target
          "win" no longer exists.
Solution: Unset target window if it is not present in config and
          reconfigured "relative" no longer expects a target window.
(cherry picked from commit 963308439a)
			
			
This commit is contained in:
		
				
					committed by
					
						
						github-actions[bot]
					
				
			
			
				
	
			
			
			
						parent
						
							f2c4305114
						
					
				
				
					commit
					0d66963089
				
			@@ -1193,6 +1193,8 @@ static bool parse_win_config(win_T *wp, Dict(win_config) *config, WinConfig *fco
 | 
			
		||||
                    "non-float with 'win' requires at least 'split' or 'vertical'");
 | 
			
		||||
      goto fail;
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    fconfig->window = 0;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (HAS_KEY_X(config, external)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -378,6 +378,21 @@ describe('float window', function()
 | 
			
		||||
    )
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  it('no error message when reconfig relative field on closed win', function()
 | 
			
		||||
    command('split')
 | 
			
		||||
    local winid = api.nvim_open_win(0, false, {
 | 
			
		||||
      relative = 'win',
 | 
			
		||||
      width = 1,
 | 
			
		||||
      height = 1,
 | 
			
		||||
      col = 1,
 | 
			
		||||
      row = 1,
 | 
			
		||||
    })
 | 
			
		||||
    eq(1001, api.nvim_win_get_config(winid).win)
 | 
			
		||||
    command('close')
 | 
			
		||||
    api.nvim_win_set_config(winid, { relative = 'editor', row = 1, col = 1 })
 | 
			
		||||
    eq(nil, api.nvim_win_get_config(winid).win)
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  it('is not operated on by windo when non-focusable #15374', function()
 | 
			
		||||
    command([[
 | 
			
		||||
      let winids = []
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user