vim: Single quote mark (#27231)

Closes #22398

Release Notes:

- vim: Adds `'` and `"` marks (last location jumped from in the current
buffer, and location when last exiting a buffer)

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
AidanV 2025-03-21 22:45:57 -07:00 committed by GitHub
parent d82b547596
commit fa677bdc38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 88 additions and 3 deletions

View file

@ -2147,6 +2147,7 @@ impl Editor {
self.push_to_nav_history(
*old_cursor_position,
Some(new_cursor_position.to_point(buffer)),
false,
cx,
);
@ -10809,10 +10810,15 @@ impl Editor {
self.nav_history.as_ref()
}
pub fn create_nav_history_entry(&mut self, cx: &mut Context<Self>) {
self.push_to_nav_history(self.selections.newest_anchor().head(), None, false, cx);
}
fn push_to_nav_history(
&mut self,
cursor_anchor: Anchor,
new_position: Option<Point>,
is_deactivate: bool,
cx: &mut Context<Self>,
) {
if let Some(nav_history) = self.nav_history.as_mut() {
@ -10838,6 +10844,10 @@ impl Editor {
}),
cx,
);
cx.emit(EditorEvent::PushedToNavHistory {
anchor: cursor_anchor,
is_deactivate,
})
}
}
@ -18617,6 +18627,10 @@ pub enum EditorEvent {
},
Reloaded,
CursorShapeChanged,
PushedToNavHistory {
anchor: Anchor,
is_deactivate: bool,
},
}
impl EventEmitter<EditorEvent> for Editor {}