|
|
@ -4655,8 +4655,6 @@ fn replay_macro(cx: &mut Context) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cx.editor.macro_replaying.push(reg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let keys: Vec<KeyEvent> = if let Some([keys_str]) = cx.editor.registers.read(reg) {
|
|
|
|
let keys: Vec<KeyEvent> = if let Some([keys_str]) = cx.editor.registers.read(reg) {
|
|
|
|
match helix_view::input::parse_macro(keys_str) {
|
|
|
|
match helix_view::input::parse_macro(keys_str) {
|
|
|
|
Ok(keys) => keys,
|
|
|
|
Ok(keys) => keys,
|
|
|
@ -4670,6 +4668,10 @@ fn replay_macro(cx: &mut Context) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Once the macro has been fully validated, it's marked as being under replay
|
|
|
|
|
|
|
|
// to ensure we don't fall into infinite recursion.
|
|
|
|
|
|
|
|
cx.editor.macro_replaying.push(reg);
|
|
|
|
|
|
|
|
|
|
|
|
let count = cx.count();
|
|
|
|
let count = cx.count();
|
|
|
|
cx.callback = Some(Box::new(move |compositor, cx| {
|
|
|
|
cx.callback = Some(Box::new(move |compositor, cx| {
|
|
|
|
for _ in 0..count {
|
|
|
|
for _ in 0..count {
|
|
|
@ -4677,7 +4679,9 @@ fn replay_macro(cx: &mut Context) {
|
|
|
|
compositor.handle_event(crossterm::event::Event::Key(key.into()), cx);
|
|
|
|
compositor.handle_event(crossterm::event::Event::Key(key.into()), cx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
// The macro under replay is cleared at the end of the callback, not in the
|
|
|
|
|
|
|
|
// macro replay context, or it will not correctly protect the user from
|
|
|
|
|
|
|
|
// replaying recursively.
|
|
|
|
cx.editor.macro_replaying.pop();
|
|
|
|
cx.editor.macro_replaying.pop();
|
|
|
|
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|