|
|
@ -3,6 +3,7 @@ use crate::{
|
|
|
|
document::{
|
|
|
|
document::{
|
|
|
|
DocumentOpenError, DocumentSavedEventFuture, DocumentSavedEventResult, Mode, SavePoint,
|
|
|
|
DocumentOpenError, DocumentSavedEventFuture, DocumentSavedEventResult, Mode, SavePoint,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
events::DocumentFocusLost,
|
|
|
|
graphics::{CursorKind, Rect},
|
|
|
|
graphics::{CursorKind, Rect},
|
|
|
|
handlers::Handlers,
|
|
|
|
handlers::Handlers,
|
|
|
|
info::Info,
|
|
|
|
info::Info,
|
|
|
@ -13,6 +14,7 @@ use crate::{
|
|
|
|
Document, DocumentId, View, ViewId,
|
|
|
|
Document, DocumentId, View, ViewId,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use dap::StackFrame;
|
|
|
|
use dap::StackFrame;
|
|
|
|
|
|
|
|
use helix_event::dispatch;
|
|
|
|
use helix_vcs::DiffProviderRegistry;
|
|
|
|
use helix_vcs::DiffProviderRegistry;
|
|
|
|
|
|
|
|
|
|
|
|
use futures_util::stream::select_all::SelectAll;
|
|
|
|
use futures_util::stream::select_all::SelectAll;
|
|
|
@ -1553,7 +1555,7 @@ impl Editor {
|
|
|
|
self.enter_normal_mode();
|
|
|
|
self.enter_normal_mode();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
match action {
|
|
|
|
let focust_lost = match action {
|
|
|
|
Action::Replace => {
|
|
|
|
Action::Replace => {
|
|
|
|
let (view, doc) = current_ref!(self);
|
|
|
|
let (view, doc) = current_ref!(self);
|
|
|
|
// If the current view is an empty scratch buffer and is not displayed in any other views, delete it.
|
|
|
|
// If the current view is an empty scratch buffer and is not displayed in any other views, delete it.
|
|
|
@ -1603,6 +1605,10 @@ impl Editor {
|
|
|
|
|
|
|
|
|
|
|
|
self.replace_document_in_view(view_id, id);
|
|
|
|
self.replace_document_in_view(view_id, id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dispatch(DocumentFocusLost {
|
|
|
|
|
|
|
|
editor: self,
|
|
|
|
|
|
|
|
doc: id,
|
|
|
|
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Action::Load => {
|
|
|
|
Action::Load => {
|
|
|
@ -1613,6 +1619,7 @@ impl Editor {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Action::HorizontalSplit | Action::VerticalSplit => {
|
|
|
|
Action::HorizontalSplit | Action::VerticalSplit => {
|
|
|
|
|
|
|
|
let focus_lost = self.tree.try_get(self.tree.focus).map(|view| view.doc);
|
|
|
|
// copy the current view, unless there is no view yet
|
|
|
|
// copy the current view, unless there is no view yet
|
|
|
|
let view = self
|
|
|
|
let view = self
|
|
|
|
.tree
|
|
|
|
.tree
|
|
|
@ -1632,10 +1639,17 @@ impl Editor {
|
|
|
|
let doc = doc_mut!(self, &id);
|
|
|
|
let doc = doc_mut!(self, &id);
|
|
|
|
doc.ensure_view_init(view_id);
|
|
|
|
doc.ensure_view_init(view_id);
|
|
|
|
doc.mark_as_focused();
|
|
|
|
doc.mark_as_focused();
|
|
|
|
|
|
|
|
focus_lost
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
self._refresh();
|
|
|
|
self._refresh();
|
|
|
|
|
|
|
|
if let Some(focus_lost) = focust_lost {
|
|
|
|
|
|
|
|
dispatch(DocumentFocusLost {
|
|
|
|
|
|
|
|
editor: self,
|
|
|
|
|
|
|
|
doc: focus_lost,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Generate an id for a new document and register it.
|
|
|
|
/// Generate an id for a new document and register it.
|
|
|
@ -1862,11 +1876,15 @@ impl Editor {
|
|
|
|
let doc = doc_mut!(self, &view.doc);
|
|
|
|
let doc = doc_mut!(self, &view.doc);
|
|
|
|
view.sync_changes(doc);
|
|
|
|
view.sync_changes(doc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let view = view!(self, view_id);
|
|
|
|
let view = view!(self, view_id);
|
|
|
|
let doc = doc_mut!(self, &view.doc);
|
|
|
|
let doc = doc_mut!(self, &view.doc);
|
|
|
|
doc.mark_as_focused();
|
|
|
|
doc.mark_as_focused();
|
|
|
|
|
|
|
|
let focus_lost = self.tree.get(prev_id).doc;
|
|
|
|
|
|
|
|
dispatch(DocumentFocusLost {
|
|
|
|
|
|
|
|
editor: self,
|
|
|
|
|
|
|
|
doc: focus_lost,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn focus_next(&mut self) {
|
|
|
|
pub fn focus_next(&mut self) {
|
|
|
|