Commit c4db9bd1 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

KRunner: Handle escape key in history view more gracefully

Instead of adding an unprintable character to the UI the history view is
closed and the text field it focused.

To prevent unprintable characters like backspace a regex is used,
just like we already do in the ResultsView Keys.onPressed slot.

BUG: 433723
FIXED-IN: 5.21.2
parent e328b546
......@@ -325,7 +325,12 @@ ColumnLayout {
} else if (ctrl && event.key === Qt.Key_K) {
decrementCurrentIndex()
} else if (event.text !== "") {
queryField.text += event.text;
// This prevents unprintable control characters from being inserted
if (event.key == Qt.Key_Escape) {
root.showHistory = false
} else if (!/[\x00-\x1F\x7F]/.test(event.text)) {
queryField.text += event.text;
}
queryField.focus = true;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment