mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 02:37:21 +00:00
Don't replay ShowCharacterPalette
This commit is contained in:
parent
8e2e00e003
commit
88dae22e3e
1 changed files with 18 additions and 4 deletions
|
@ -4,11 +4,19 @@ use crate::{
|
||||||
visual::visual_motion,
|
visual::visual_motion,
|
||||||
Vim,
|
Vim,
|
||||||
};
|
};
|
||||||
use gpui::{actions, AppContext};
|
use gpui::{actions, Action, AppContext};
|
||||||
use workspace::Workspace;
|
use workspace::Workspace;
|
||||||
|
|
||||||
actions!(vim, [Repeat, EndRepeat,]);
|
actions!(vim, [Repeat, EndRepeat,]);
|
||||||
|
|
||||||
|
fn should_replay(action: &Box<dyn Action>) -> bool {
|
||||||
|
// skip so that we don't leave the character palette open
|
||||||
|
if editor::ShowCharacterPalette.id() == action.id() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn init(cx: &mut AppContext) {
|
pub(crate) fn init(cx: &mut AppContext) {
|
||||||
cx.add_action(|_: &mut Workspace, _: &EndRepeat, cx| {
|
cx.add_action(|_: &mut Workspace, _: &EndRepeat, cx| {
|
||||||
Vim::update(cx, |vim, cx| {
|
Vim::update(cx, |vim, cx| {
|
||||||
|
@ -118,9 +126,15 @@ pub(crate) fn init(cx: &mut AppContext) {
|
||||||
.spawn(move |mut cx| async move {
|
.spawn(move |mut cx| async move {
|
||||||
for action in actions {
|
for action in actions {
|
||||||
match action {
|
match action {
|
||||||
ReplayableAction::Action(action) => window
|
ReplayableAction::Action(action) => {
|
||||||
.dispatch_action(editor.id(), action.as_ref(), &mut cx)
|
if should_replay(&action) {
|
||||||
.ok_or_else(|| anyhow::anyhow!("window was closed")),
|
window
|
||||||
|
.dispatch_action(editor.id(), action.as_ref(), &mut cx)
|
||||||
|
.ok_or_else(|| anyhow::anyhow!("window was closed"))
|
||||||
|
} else {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
ReplayableAction::Insertion {
|
ReplayableAction::Insertion {
|
||||||
text,
|
text,
|
||||||
utf16_range_to_replace,
|
utf16_range_to_replace,
|
||||||
|
|
Loading…
Reference in a new issue