@@ -1057,7 +1057,6 @@ impl EditorView {
10571057
10581058 pub fn set_completion (
10591059 & mut self ,
1060- // compositor: &mut crate::compositor::Compositor,
10611060 signature_help_area : Option < Rect > ,
10621061 editor : & mut Editor ,
10631062 items : Vec < helix_lsp:: lsp:: CompletionItem > ,
@@ -1307,7 +1306,7 @@ impl Component for EditorView {
13071306 event : & Event ,
13081307 context : & mut crate :: compositor:: Context ,
13091308 ) -> EventResult {
1310- let mut cx = commands:: Context {
1309+ let mut cxt = commands:: Context {
13111310 editor : context. editor ,
13121311 count : None ,
13131312 register : None ,
@@ -1318,13 +1317,13 @@ impl Component for EditorView {
13181317
13191318 match event {
13201319 Event :: Paste ( contents) => {
1321- cx . count = cx . editor . count ;
1322- commands:: paste_bracketed_value ( & mut cx , contents. clone ( ) ) ;
1323- cx . editor . count = None ;
1320+ cxt . count = cxt . editor . count ;
1321+ commands:: paste_bracketed_value ( & mut cxt , contents. clone ( ) ) ;
1322+ cxt . editor . count = None ;
13241323
1325- let config = cx . editor . config ( ) ;
1326- let mode = cx . editor . mode ( ) ;
1327- let ( view, doc) = current ! ( cx . editor) ;
1324+ let config = cxt . editor . config ( ) ;
1325+ let mode = cxt . editor . mode ( ) ;
1326+ let ( view, doc) = current ! ( cxt . editor) ;
13281327 view. ensure_cursor_in_view ( doc, config. scrolloff ) ;
13291328
13301329 // Store a history state if not in insert mode. Otherwise wait till we exit insert
@@ -1341,19 +1340,19 @@ impl Component for EditorView {
13411340 EventResult :: Consumed ( None )
13421341 }
13431342 Event :: Key ( mut key) => {
1344- cx . editor . reset_idle_timer ( ) ;
1343+ cxt . editor . reset_idle_timer ( ) ;
13451344 canonicalize_key ( & mut key) ;
13461345
13471346 // clear status
1348- cx . editor . status_msg = None ;
1347+ cxt . editor . status_msg = None ;
13491348
1350- let mode = cx . editor . mode ( ) ;
1351- let ( view, _) = current ! ( cx . editor) ;
1349+ let mode = cxt . editor . mode ( ) ;
1350+ let ( view, _) = current ! ( cxt . editor) ;
13521351 let focus = view. id ;
13531352
13541353 if let Some ( on_next_key) = self . on_next_key . take ( ) {
13551354 // if there's a command waiting input, do that first
1356- on_next_key ( & mut cx , key) ;
1355+ on_next_key ( & mut cxt , key) ;
13571356 } else {
13581357 match mode {
13591358 Mode :: Insert => {
@@ -1362,8 +1361,8 @@ impl Component for EditorView {
13621361 if let Some ( completion) = & mut self . completion {
13631362 // use a fake context here
13641363 let mut cx = Context {
1365- editor : cx . editor ,
1366- jobs : cx . jobs ,
1364+ editor : cxt . editor ,
1365+ jobs : cxt . jobs ,
13671366 scroll : None ,
13681367 } ;
13691368 let res = completion. handle_event ( event, & mut cx) ;
@@ -1374,55 +1373,61 @@ impl Component for EditorView {
13741373 if callback. is_some ( ) {
13751374 // assume close_fn
13761375 self . clear_completion ( cx. editor ) ;
1376+
1377+ // In case the popup was deleted beacuse of an intersection w/ the auto-complete menu.
1378+ commands:: signature_help_impl (
1379+ & mut cxt,
1380+ commands:: SignatureHelpInvoked :: Automatic ,
1381+ ) ;
13771382 }
13781383 }
13791384 }
13801385
13811386 // if completion didn't take the event, we pass it onto commands
13821387 if !consumed {
1383- if let Some ( compl) = cx . editor . last_completion . take ( ) {
1388+ if let Some ( compl) = cxt . editor . last_completion . take ( ) {
13841389 self . last_insert . 1 . push ( InsertEvent :: CompletionApply ( compl) ) ;
13851390 }
13861391
1387- self . insert_mode ( & mut cx , key) ;
1392+ self . insert_mode ( & mut cxt , key) ;
13881393
13891394 // record last_insert key
13901395 self . last_insert . 1 . push ( InsertEvent :: Key ( key) ) ;
13911396
13921397 // lastly we recalculate completion
13931398 if let Some ( completion) = & mut self . completion {
1394- completion. update ( & mut cx ) ;
1399+ completion. update ( & mut cxt ) ;
13951400 if completion. is_empty ( ) {
1396- self . clear_completion ( cx . editor ) ;
1401+ self . clear_completion ( cxt . editor ) ;
13971402 }
13981403 }
13991404 }
14001405 }
1401- mode => self . command_mode ( mode, & mut cx , key) ,
1406+ mode => self . command_mode ( mode, & mut cxt , key) ,
14021407 }
14031408 }
14041409
1405- self . on_next_key = cx . on_next_key_callback . take ( ) ;
1410+ self . on_next_key = cxt . on_next_key_callback . take ( ) ;
14061411 match self . on_next_key {
14071412 Some ( _) => self . pseudo_pending . push ( key) ,
14081413 None => self . pseudo_pending . clear ( ) ,
14091414 }
14101415
14111416 // appease borrowck
1412- let callback = cx . callback . take ( ) ;
1417+ let callback = cxt . callback . take ( ) ;
14131418
14141419 // if the command consumed the last view, skip the render.
14151420 // on the next loop cycle the Application will then terminate.
1416- if cx . editor . should_close ( ) {
1421+ if cxt . editor . should_close ( ) {
14171422 return EventResult :: Ignored ( None ) ;
14181423 }
14191424
14201425 // if the focused view still exists and wasn't closed
1421- if cx . editor . tree . contains ( focus) {
1422- let config = cx . editor . config ( ) ;
1423- let mode = cx . editor . mode ( ) ;
1424- let view = view_mut ! ( cx . editor, focus) ;
1425- let doc = doc_mut ! ( cx . editor, & view. doc) ;
1426+ if cxt . editor . tree . contains ( focus) {
1427+ let config = cxt . editor . config ( ) ;
1428+ let mode = cxt . editor . mode ( ) ;
1429+ let view = view_mut ! ( cxt . editor, focus) ;
1430+ let doc = doc_mut ! ( cxt . editor, & view. doc) ;
14261431
14271432 view. ensure_cursor_in_view ( doc, config. scrolloff ) ;
14281433
@@ -1436,8 +1441,8 @@ impl Component for EditorView {
14361441 EventResult :: Consumed ( callback)
14371442 }
14381443
1439- Event :: Mouse ( event) => self . handle_mouse_event ( event, & mut cx ) ,
1440- Event :: IdleTimeout => self . handle_idle_timeout ( & mut cx ) ,
1444+ Event :: Mouse ( event) => self . handle_mouse_event ( event, & mut cxt ) ,
1445+ Event :: IdleTimeout => self . handle_idle_timeout ( & mut cxt ) ,
14411446 Event :: FocusGained => EventResult :: Ignored ( None ) ,
14421447 Event :: FocusLost => {
14431448 if context. editor . config ( ) . auto_save {
0 commit comments