mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	fix(ui): update ext_ui widgets when attaching non-remote UI
Problem:  Updating internalized UI capabilities is postponed until a
          remote UI attaches.
Solution: Always update active UI widgets in ui_refresh().
			
			
This commit is contained in:
		@@ -194,15 +194,6 @@ void ui_refresh(void)
 | 
			
		||||
    abort();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (!ui_active()) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (updating_screen) {
 | 
			
		||||
    ui_schedule_refresh();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  int width = INT_MAX;
 | 
			
		||||
  int height = INT_MAX;
 | 
			
		||||
  bool ext_widgets[kUIExtCount];
 | 
			
		||||
@@ -234,11 +225,19 @@ void ui_refresh(void)
 | 
			
		||||
    }
 | 
			
		||||
    ui_ext[i] = ext_widgets[i];
 | 
			
		||||
    if (i < kUIGlobalCount) {
 | 
			
		||||
      ui_call_option_set(cstr_as_string(ui_ext_names[i]),
 | 
			
		||||
                         BOOLEAN_OBJ(ext_widgets[i]));
 | 
			
		||||
      ui_call_option_set(cstr_as_string(ui_ext_names[i]), BOOLEAN_OBJ(ext_widgets[i]));
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (!ui_active()) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (updating_screen) {
 | 
			
		||||
    ui_schedule_refresh();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ui_default_colors_set();
 | 
			
		||||
 | 
			
		||||
  int save_p_lz = p_lz;
 | 
			
		||||
 
 | 
			
		||||
@@ -155,6 +155,14 @@ describe('vim.ui_attach', function()
 | 
			
		||||
      },
 | 
			
		||||
    }, actual, vim.inspect(actual))
 | 
			
		||||
  end)
 | 
			
		||||
 | 
			
		||||
  it('ui_refresh() works without remote UI', function()
 | 
			
		||||
    screen:detach()
 | 
			
		||||
    exec_lua('vim.ui_attach(ns, { ext_messages = true }, on_event)')
 | 
			
		||||
    n.api.nvim_set_option_value('cmdheight', 1, {})
 | 
			
		||||
    screen:attach()
 | 
			
		||||
    eq(1, n.api.nvim_get_option_value('cmdheight', {}))
 | 
			
		||||
  end)
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
describe('vim.ui_attach', function()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user