@@ -43,6 +43,8 @@ pub struct EditorView {
43 pub(crate) last_insert: (commands::MappableCommand, Vec<InsertEvent>),
43 pub(crate) last_insert: (commands::MappableCommand, Vec<InsertEvent>),
44 pub(crate) completion: Option<Completion>,
44 pub(crate) completion: Option<Completion>,
45 spinners: ProgressSpinners,
45 spinners: ProgressSpinners,
46+ /// Tracks if the terminal window is focused by reaction to terminal focus events
47+ terminal_focused: bool,
48#[derive(Debug, Clone)]
50#[derive(Debug, Clone)]
@@ -71,6 +73,7 @@ impl EditorView {
71 last_insert: (commands::MappableCommand::normal_mode, Vec::new()),
73 last_insert: (commands::MappableCommand::normal_mode, Vec::new()),
72 completion: None,
74 completion: None,
73 spinners: ProgressSpinners::default(),
75 spinners: ProgressSpinners::default(),
76+ terminal_focused: true,
@@ -171,7 +174,7 @@ impl EditorView {
172 view.area,
175 view.area,
174− is_focused,
177+ is_focused & self.terminal_focused,
175 &mut line_decorations,
178 &mut line_decorations,
@@ -1372,13 +1375,17 @@ impl Component for EditorView {
1373 Event::Mouse(event) => self.handle_mouse_event(event, &mut cx),
1376 Event::Mouse(event) => self.handle_mouse_event(event, &mut cx),
1374 Event::IdleTimeout => self.handle_idle_timeout(&mut cx),
1377 Event::IdleTimeout => self.handle_idle_timeout(&mut cx),
1375− Event::FocusGained => EventResult::Ignored(None),
1378+ Event::FocusGained => {
1379+ self.terminal_focused = true;
1380+ EventResult::Consumed(None)
1376 Event::FocusLost => {
1382 Event::FocusLost => {
1377 if context.editor.config().auto_save {
1383 if context.editor.config().auto_save {
1378 if let Err(e) = commands::typed::write_all_impl(context, false, false) {
1384 if let Err(e) = commands::typed::write_all_impl(context, false, false) {
1379 context.editor.set_error(format!("{}", e));
1385 context.editor.set_error(format!("{}", e));
1388+ self.terminal_focused = false;
1382 EventResult::Consumed(None)
1389 EventResult::Consumed(None)