@@ -216,7 +216,7 @@ def write_input_scrolled(self, cli, screen, write_content,
216216 self .vertical_scroll  =  (temp_screen .cursor_position .y  +  1 ) -  max_height 
217217
218218 # Scroll down if we need space for the menu. 
219-  if  self .need_to_show_completion_menu (cli ):
219+  if  self ._need_to_show_completion_menu (cli ):
220220 menu_size  =  self .menus [0 ].get_height (self ._line (cli ).complete_state )
221221 if  temp_screen .cursor_position .y  -  self .vertical_scroll  >=  max_height  -  menu_size :
222222 self .vertical_scroll  =  (temp_screen .cursor_position .y  +  1 ) -  (max_height  -  menu_size )
@@ -240,7 +240,7 @@ def write_input_scrolled(self, cli, screen, write_content,
240240 y_after_input  =  y  +  top_margin 
241241
242242 # Show completion menu. 
243-  if  not  is_done  and  self .need_to_show_completion_menu (cli ):
243+  if  not  is_done  and  self ._need_to_show_completion_menu (cli ):
244244 y , x  =  temp_screen ._cursor_mappings [self ._line (cli ).complete_state .original_document .cursor_position ]
245245 self .menus [0 ].write (screen , (y  -  self .vertical_scroll  +  top_margin , x  +  left_margin_width ), self ._line (cli ).complete_state )
246246
@@ -256,11 +256,8 @@ def write_input_scrolled(self, cli, screen, write_content,
256256
257257 return  return_value 
258258
259-  def  need_to_show_completion_menu (self , cli ): # XXX: remove 
260-  if  cli .input_processor .input_mode  in  (InputMode .SYSTEM , InputMode .INCREMENTAL_SEARCH ):
261-  return  False 
262- 
263-  return  self .menus  and  self ._line (cli ).complete_state 
259+  def  _need_to_show_completion_menu (self , cli ):
260+  return  self .menus  and  self .menus [0 ].is_visible (cli )
264261
265262 def  write_to_screen (self , cli , screen , min_height ):
266263 """ 
0 commit comments