diff --git a/src/UI/Dialog/DialogBox.cs b/src/UI/Dialog/DialogBox.cs
index 7a5bf8b..ca750c2 100644
--- a/src/UI/Dialog/DialogBox.cs
+++ b/src/UI/Dialog/DialogBox.cs
@@ -247,6 +247,8 @@ namespace Cthangover.Mods.Dialog
if (@event.IsActionPressed("ui_accept"))
{
+ if (IsTyping())
+ return;
GameLogger.Log("DIALOG", "input: advancing dialog");
NextAction();
}
@@ -256,6 +258,9 @@ namespace Cthangover.Mods.Dialog
if (action == null || action.WaitType == WaitType.WaitTime || action.WaitType == WaitType.WaitEvent)
return;
+ if (IsOverOtherControl())
+ return;
+
if (Body is Control bodyControl)
{
var bodyRect = bodyControl.GetGlobalRect();
@@ -269,6 +274,25 @@ namespace Cthangover.Mods.Dialog
}
}
+ ///
+ /// True while a text field has keyboard focus: Enter and Space belong to
+ /// it, not to the dialog (the dialog reads ui_accept in
+ /// _Input, before the GUI).
+ ///
+ private bool IsTyping() => GetViewport()?.GuiGetFocusOwner() is LineEdit or TextEdit;
+
+ ///
+ /// True when the mouse is over a control that is not part of this box and
+ /// stops the mouse (a tool panel, a button drawn over the dialog area):
+ /// the click is meant for that control.
+ ///
+ private bool IsOverOtherControl()
+ {
+ var hovered = GetViewport()?.GuiGetHoveredControl();
+ return hovered != null && hovered != this && !IsAncestorOf(hovered)
+ && hovered.MouseFilter == MouseFilterEnum.Stop;
+ }
+
///
/// Continues a dialog the debugger held ():
/// runs from the held action on, exactly as if it had never stopped.