diff --git a/src/Gui/ChatInputBox.cs b/src/Gui/ChatInputBox.cs index 2ff32f8..c98d64e 100644 --- a/src/Gui/ChatInputBox.cs +++ b/src/Gui/ChatInputBox.cs @@ -29,14 +29,12 @@ namespace WorldOfPeacecraft private void KeyDownEvent (object o, KeyEventArgs args) { if (args.KeyCode == Keys.Return) { - if (this.Text != "") - { + if (this.Text != "") { string message = this.Text; this.Text = ""; if (CurrentHistoryEntry == null) { InputHistory.AddLast (message); - } - else { + } else { CurrentHistoryEntry.Value = message; CurrentHistoryEntry = null; } @@ -49,9 +47,8 @@ namespace WorldOfPeacecraft if (InputHistory.Count > 0) { if (CurrentHistoryEntry == null) { CurrentHistoryEntry = InputHistory.Last; - if (this.Text != "") - { - InputHistory.AddLast(this.Text); + if (this.Text != "") { + InputHistory.AddLast (this.Text); } this.Text = CurrentHistoryEntry.Value; args.Handled = true; @@ -65,8 +62,7 @@ namespace WorldOfPeacecraft } } } else if (args.KeyCode == Keys.Down) { - if (CurrentHistoryEntry != null) - { + if (CurrentHistoryEntry != null) { CurrentHistoryEntry.Value = this.Text; CurrentHistoryEntry = CurrentHistoryEntry.Next; if (CurrentHistoryEntry == null) { @@ -75,6 +71,9 @@ namespace WorldOfPeacecraft this.Text = CurrentHistoryEntry.Value; } } + } else if (args.KeyCode == Keys.Escape) { + ((Gui)this.Parent.Parent).FocusMap(); + args.Handled = true; } } } diff --git a/src/Gui/Gui.cs b/src/Gui/Gui.cs index 3c7f0f2..d7aac57 100644 --- a/src/Gui/Gui.cs +++ b/src/Gui/Gui.cs @@ -24,6 +24,11 @@ namespace WorldOfPeacecraft Backend = backend; } + public void FocusMap () + { + MapPanel.Focus(); + } + protected override void OnLoad (EventArgs e) { base.OnLoad (e);