Fix cmd+k in terminal and fix sporadic keybind misses (#7388)
This fixes `cmd+k` in the terminal taking 1s to have an effect. It is now immediate. It also fixes #7270 by ensuring that we don't set a bad state when matching keybindings. It matches keybindings per context and if it finds a match on a lower context it doesn't keep pending keystrokes. If it finds two matches on the same context level, requiring more keystrokes, then it waits. Release Notes: - Fixed `cmd-k` in terminal taking 1s to have an effect. Also fixed sporadic non-matching of keybindings if there are overlapping keybindings. ([#7270](https://github.com/zed-industries/zed/issues/7270)). --------- Co-authored-by: Conrad <conrad@zed.dev> Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
47329f4489
commit
583ce44359
6 changed files with 71 additions and 82 deletions
|
@ -31,11 +31,11 @@ use crate::{
|
|||
prelude::*, size, AnyTooltip, AppContext, AvailableSpace, Bounds, BoxShadow, ContentMask,
|
||||
Corners, CursorStyle, DevicePixels, DispatchPhase, DispatchTree, ElementId, ElementStateBox,
|
||||
EntityId, FocusHandle, FocusId, FontId, GlobalElementId, GlyphId, Hsla, ImageData,
|
||||
InputHandler, IsZero, KeyContext, KeyEvent, KeymatchMode, LayoutId, MonochromeSprite,
|
||||
MouseEvent, PaintQuad, Path, Pixels, PlatformInputHandler, Point, PolychromeSprite, Quad,
|
||||
RenderGlyphParams, RenderImageParams, RenderSvgParams, Scene, Shadow, SharedString, Size,
|
||||
StackingContext, StackingOrder, Style, Surface, TextStyleRefinement, Underline, UnderlineStyle,
|
||||
Window, WindowContext, SUBPIXEL_VARIANTS,
|
||||
InputHandler, IsZero, KeyContext, KeyEvent, LayoutId, MonochromeSprite, MouseEvent, PaintQuad,
|
||||
Path, Pixels, PlatformInputHandler, Point, PolychromeSprite, Quad, RenderGlyphParams,
|
||||
RenderImageParams, RenderSvgParams, Scene, Shadow, SharedString, Size, StackingContext,
|
||||
StackingOrder, Style, Surface, TextStyleRefinement, Underline, UnderlineStyle, Window,
|
||||
WindowContext, SUBPIXEL_VARIANTS,
|
||||
};
|
||||
|
||||
type AnyMouseListener = Box<dyn FnMut(&dyn Any, DispatchPhase, &mut ElementContext) + 'static>;
|
||||
|
@ -1143,15 +1143,6 @@ impl<'a> ElementContext<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// keymatch mode immediate instructs GPUI to prefer shorter action bindings.
|
||||
/// In the case that you have a keybinding of `"cmd-k": "terminal::Clear"` and
|
||||
/// `"cmd-k left": "workspace::MoveLeft"`, GPUI will by default wait for 1s after
|
||||
/// you type cmd-k to see if you're going to type left.
|
||||
/// This is problematic in the terminal
|
||||
pub fn keymatch_mode_immediate(&mut self) {
|
||||
self.window.next_frame.dispatch_tree.keymatch_mode = KeymatchMode::Immediate;
|
||||
}
|
||||
|
||||
/// Register a mouse event listener on the window for the next frame. The type of event
|
||||
/// is determined by the first parameter of the given listener. When the next frame is rendered
|
||||
/// the listener will be cleared.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue