vim . to replay

Co-Authored-By: maxbrunsfeld@gmail.com
This commit is contained in:
Conrad Irwin 2023-08-21 16:10:13 -06:00
parent c2c04616b4
commit 20f98e4d17
19 changed files with 544 additions and 40 deletions

View file

@ -1,4 +1,6 @@
use gpui::keymap_matcher::KeymapContext;
use std::{ops::Range, sync::Arc};
use gpui::{keymap_matcher::KeymapContext, Action};
use language::CursorShape;
use serde::{Deserialize, Serialize};
use workspace::searchable::Direction;
@ -52,6 +54,36 @@ pub struct EditorState {
pub struct WorkspaceState {
pub search: SearchState,
pub last_find: Option<Motion>,
pub recording: bool,
pub stop_recording_after_next_action: bool,
pub replaying: bool,
pub recorded_count: Option<usize>,
pub repeat_actions: Vec<ReplayableAction>,
}
#[derive(Debug)]
pub enum ReplayableAction {
Action(Box<dyn Action>),
Insertion {
text: Arc<str>,
utf16_range_to_replace: Option<Range<isize>>,
},
}
impl Clone for ReplayableAction {
fn clone(&self) -> Self {
match self {
Self::Action(action) => Self::Action(action.boxed_clone()),
Self::Insertion {
text,
utf16_range_to_replace,
} => Self::Insertion {
text: text.clone(),
utf16_range_to_replace: utf16_range_to_replace.clone(),
},
}
}
}
#[derive(Clone)]