mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 12:09:57 +00:00
SettingsLog: add command history
This commit is contained in:
parent
b7b1221221
commit
410897ced7
1 changed files with 20 additions and 0 deletions
|
@ -213,9 +213,27 @@ Rectangle {
|
||||||
MoneroComponents.LineEdit {
|
MoneroComponents.LineEdit {
|
||||||
id: sendCommandText
|
id: sendCommandText
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
property var lastCommands: []
|
||||||
|
property int currentCommandIndex
|
||||||
fontBold: false
|
fontBold: false
|
||||||
placeholderText: qsTr("command + enter (e.g 'help' or 'status')") + translationManager.emptyString
|
placeholderText: qsTr("command + enter (e.g 'help' or 'status')") + translationManager.emptyString
|
||||||
placeholderFontSize: 16
|
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: {
|
onAccepted: {
|
||||||
if(text.length > 0) {
|
if(text.length > 0) {
|
||||||
consoleArea.logCommand(">>> " + text)
|
consoleArea.logCommand(">>> " + text)
|
||||||
|
@ -225,6 +243,8 @@ Rectangle {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
lastCommands.push(text);
|
||||||
|
currentCommandIndex = lastCommands.length;
|
||||||
text = ""
|
text = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue