Skip to content

Commit 88185ee

Browse files
committed
Allow clearing text box with ESC if IME composition is empty
1 parent 3b9ebf7 commit 88185ee

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/TSMapEditor/UI/IME/IMEHandler.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,16 @@ protected virtual void OnIMETextInput(char character)
7878

7979
if (IMEFocus != null)
8080
{
81-
TextBoxHandleChatInputCallbacks.TryGetValue(IMEFocus, out var handleChatInput);
82-
handleChatInput?.Invoke(character);
81+
// Handle ESC
82+
if (character == 27 && CompositionEmpty)
83+
{
84+
IMEFocus.Text = string.Empty;
85+
}
86+
else
87+
{
88+
TextBoxHandleChatInputCallbacks.TryGetValue(IMEFocus, out var handleChatInput);
89+
handleChatInput?.Invoke(character);
90+
}
8391
}
8492
}
8593

0 commit comments

Comments
 (0)