@@ -1307,7 +1307,7 @@ impl Component for EditorView {
13071307 event : & Event ,
13081308 context : & mut crate :: compositor:: Context ,
13091309 ) -> EventResult {
1310- let mut cx = commands:: Context {
1310+ let mut cxt = commands:: Context {
13111311 editor : context. editor ,
13121312 count : None ,
13131313 register : None ,
@@ -1318,13 +1318,13 @@ impl Component for EditorView {
13181318
13191319 match event {
13201320 Event :: Paste ( contents) => {
1321- cx . count = cx . editor . count ;
1322- commands:: paste_bracketed_value ( & mut cx , contents. clone ( ) ) ;
1323- cx . editor . count = None ;
1321+ cxt . count = cxt . editor . count ;
1322+ commands:: paste_bracketed_value ( & mut cxt , contents. clone ( ) ) ;
1323+ cxt . editor . count = None ;
13241324
1325- let config = cx . editor . config ( ) ;
1326- let mode = cx . editor . mode ( ) ;
1327- let ( view, doc) = current ! ( cx . editor) ;
1325+ let config = cxt . editor . config ( ) ;
1326+ let mode = cxt . editor . mode ( ) ;
1327+ let ( view, doc) = current ! ( cxt . editor) ;
13281328 view. ensure_cursor_in_view ( doc, config. scrolloff ) ;
13291329
13301330 // Store a history state if not in insert mode. Otherwise wait till we exit insert
@@ -1341,19 +1341,19 @@ impl Component for EditorView {
13411341 EventResult :: Consumed ( None )
13421342 }
13431343 Event :: Key ( mut key) => {
1344- cx . editor . reset_idle_timer ( ) ;
1344+ cxt . editor . reset_idle_timer ( ) ;
13451345 canonicalize_key ( & mut key) ;
13461346
13471347 // clear status
1348- cx . editor . status_msg = None ;
1348+ cxt . editor . status_msg = None ;
13491349
1350- let mode = cx . editor . mode ( ) ;
1351- let ( view, _) = current ! ( cx . editor) ;
1350+ let mode = cxt . editor . mode ( ) ;
1351+ let ( view, _) = current ! ( cxt . editor) ;
13521352 let focus = view. id ;
13531353
13541354 if let Some ( on_next_key) = self . on_next_key . take ( ) {
13551355 // if there's a command waiting input, do that first
1356- on_next_key ( & mut cx , key) ;
1356+ on_next_key ( & mut cxt , key) ;
13571357 } else {
13581358 match mode {
13591359 Mode :: Insert => {
@@ -1362,8 +1362,8 @@ impl Component for EditorView {
13621362 if let Some ( completion) = & mut self . completion {
13631363 // use a fake context here
13641364 let mut cx = Context {
1365- editor : cx . editor ,
1366- jobs : cx . jobs ,
1365+ editor : cxt . editor ,
1366+ jobs : cxt . jobs ,
13671367 scroll : None ,
13681368 } ;
13691369 let res = completion. handle_event ( event, & mut cx) ;
@@ -1374,55 +1374,61 @@ impl Component for EditorView {
13741374 if callback. is_some ( ) {
13751375 // assume close_fn
13761376 self . clear_completion ( cx. editor ) ;
1377+
1378+ // In case the popup was deleted beacuse of an intersection w/ the auto-complete menu.
1379+ commands:: signature_help_impl (
1380+ & mut cxt,
1381+ commands:: SignatureHelpInvoked :: Automatic ,
1382+ ) ;
13771383 }
13781384 }
13791385 }
13801386
13811387 // if completion didn't take the event, we pass it onto commands
13821388 if !consumed {
1383- if let Some ( compl) = cx . editor . last_completion . take ( ) {
1389+ if let Some ( compl) = cxt . editor . last_completion . take ( ) {
13841390 self . last_insert . 1 . push ( InsertEvent :: CompletionApply ( compl) ) ;
13851391 }
13861392
1387- self . insert_mode ( & mut cx , key) ;
1393+ self . insert_mode ( & mut cxt , key) ;
13881394
13891395 // record last_insert key
13901396 self . last_insert . 1 . push ( InsertEvent :: Key ( key) ) ;
13911397
13921398 // lastly we recalculate completion
13931399 if let Some ( completion) = & mut self . completion {
1394- completion. update ( & mut cx ) ;
1400+ completion. update ( & mut cxt ) ;
13951401 if completion. is_empty ( ) {
1396- self . clear_completion ( cx . editor ) ;
1402+ self . clear_completion ( cxt . editor ) ;
13971403 }
13981404 }
13991405 }
14001406 }
1401- mode => self . command_mode ( mode, & mut cx , key) ,
1407+ mode => self . command_mode ( mode, & mut cxt , key) ,
14021408 }
14031409 }
14041410
1405- self . on_next_key = cx . on_next_key_callback . take ( ) ;
1411+ self . on_next_key = cxt . on_next_key_callback . take ( ) ;
14061412 match self . on_next_key {
14071413 Some ( _) => self . pseudo_pending . push ( key) ,
14081414 None => self . pseudo_pending . clear ( ) ,
14091415 }
14101416
14111417 // appease borrowck
1412- let callback = cx . callback . take ( ) ;
1418+ let callback = cxt . callback . take ( ) ;
14131419
14141420 // if the command consumed the last view, skip the render.
14151421 // on the next loop cycle the Application will then terminate.
1416- if cx . editor . should_close ( ) {
1422+ if cxt . editor . should_close ( ) {
14171423 return EventResult :: Ignored ( None ) ;
14181424 }
14191425
14201426 // 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) ;
1427+ if cxt . editor . tree . contains ( focus) {
1428+ let config = cxt . editor . config ( ) ;
1429+ let mode = cxt . editor . mode ( ) ;
1430+ let view = view_mut ! ( cxt . editor, focus) ;
1431+ let doc = doc_mut ! ( cxt . editor, & view. doc) ;
14261432
14271433 view. ensure_cursor_in_view ( doc, config. scrolloff ) ;
14281434
@@ -1436,8 +1442,8 @@ impl Component for EditorView {
14361442 EventResult :: Consumed ( callback)
14371443 }
14381444
1439- Event :: Mouse ( event) => self . handle_mouse_event ( event, & mut cx ) ,
1440- Event :: IdleTimeout => self . handle_idle_timeout ( & mut cx ) ,
1445+ Event :: Mouse ( event) => self . handle_mouse_event ( event, & mut cxt ) ,
1446+ Event :: IdleTimeout => self . handle_idle_timeout ( & mut cxt ) ,
14411447 Event :: FocusGained => EventResult :: Ignored ( None ) ,
14421448 Event :: FocusLost => {
14431449 if context. editor . config ( ) . auto_save {
0 commit comments