aboutsummaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-07-29 09:46:04 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-07-29 09:46:04 -0500
commitc77637d141a2847b504bb586c0ddcb87b9106557 (patch)
tree78a1dc705641ca81b1eb450666c91d01a2936b19 /pages
parent0d047035fb9df9a2184ea7758fce506837e0ea0c (diff)
parent410897ced7a6b0a81ad6663c4f6c81af52670a02 (diff)
downloadmonzero-gui-c77637d141a2847b504bb586c0ddcb87b9106557.tar.gz
monzero-gui-c77637d141a2847b504bb586c0ddcb87b9106557.tar.xz
monzero-gui-c77637d141a2847b504bb586c0ddcb87b9106557.zip
Merge pull request #3012
410897c SettingsLog: add command history (rating89us)
Diffstat (limited to 'pages')
-rw-r--r--pages/settings/SettingsLog.qml20
1 files changed, 20 insertions, 0 deletions
diff --git a/pages/settings/SettingsLog.qml b/pages/settings/SettingsLog.qml
index 3e41cb01..161b868c 100644
--- a/pages/settings/SettingsLog.qml
+++ b/pages/settings/SettingsLog.qml
@@ -213,9 +213,27 @@ Rectangle {
MoneroComponents.LineEdit {
id: sendCommandText
Layout.fillWidth: true
+ property var lastCommands: []
+ property int currentCommandIndex
fontBold: false
placeholderText: qsTr("command + enter (e.g 'help' or 'status')") + translationManager.emptyString
placeholderFontSize: 16
+ Keys.onUpPressed: {
+ if (currentCommandIndex != 0) {
+ sendCommandText.text = lastCommands[currentCommandIndex - 1]
+ currentCommandIndex = currentCommandIndex - 1
+ }
+ }
+ Keys.onDownPressed: {
+ if (currentCommandIndex == lastCommands.length - 1) {
+ currentCommandIndex = lastCommands.length;
+ return text = "";
+ }
+ if (currentCommandIndex != lastCommands.length) {
+ sendCommandText.text = lastCommands[currentCommandIndex + 1]
+ currentCommandIndex = currentCommandIndex + 1
+ }
+ }
onAccepted: {
if(text.length > 0) {
consoleArea.logCommand(">>> " + text)
@@ -225,6 +243,8 @@ Rectangle {
}
});
}
+ lastCommands.push(text);
+ currentCommandIndex = lastCommands.length;
text = ""
}
}