fix(git): scope Enter swallow to a visible ready Git popover
The Enter guard keyed off branch_picker_open/overflow_open alone, so a stale flag while the panel was closed / loading / merging / showing a diff would wrongly eat the global Enter. Add git_ready_popover_open() (panel open + ready view + a popover flag) and guard on it instead.
This commit is contained in:
parent
20a6327546
commit
e323ee49ab
|
|
@ -61,6 +61,21 @@ impl WidgetHostNative {
|
|||
panel.open && panel.branch_create_focused && !panel.loading
|
||||
}
|
||||
|
||||
/// Whether a ready-state Git popover (branch picker / overflow menu) is
|
||||
/// actually visible — the panel is open, in the ready view, and a popover
|
||||
/// flag is set. Scopes the Enter swallow so a stale flag while the panel
|
||||
/// is closed / loading / merging / showing a diff can't eat global Enter.
|
||||
pub fn git_ready_popover_open(&self) -> bool {
|
||||
let p = &self.editor_state.editor_ui.git_panel;
|
||||
p.open
|
||||
&& p.in_repo
|
||||
&& !p.loading
|
||||
&& !p.merging
|
||||
&& p.diff.is_none()
|
||||
&& p.merge_resolve.is_none()
|
||||
&& (p.branch_picker_open || p.overflow_open)
|
||||
}
|
||||
|
||||
/// Whether the inline Git clone wizard is up. While it is, the
|
||||
/// wizard owns the keyboard: a focused URL / destination field takes
|
||||
/// text, and every other key is swallowed so no canvas shortcut
|
||||
|
|
|
|||
|
|
@ -646,12 +646,12 @@ impl WidgetHostNative {
|
|||
self.mark_dirty();
|
||||
return true;
|
||||
}
|
||||
// While a ready-state popover (branch picker / overflow menu) is open
|
||||
// with no focused input, swallow Enter so it can't fall through to the
|
||||
// global chat send below. (Focused inputs already submitted above.)
|
||||
if self.editor_state.editor_ui.git_panel.branch_picker_open
|
||||
|| self.editor_state.editor_ui.git_panel.overflow_open
|
||||
{
|
||||
// While a ready-state popover (branch picker / overflow menu) is
|
||||
// actually visible with no focused input, swallow Enter so it can't
|
||||
// fall through to the global chat send below. (Focused inputs already
|
||||
// submitted above; the helper requires the ready view so a stale flag
|
||||
// on a closed / merging / diff panel can't eat global Enter.)
|
||||
if self.git_ready_popover_open() {
|
||||
return true;
|
||||
}
|
||||
if self.editor_state.ui.layer_rename.is_some() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue