WIP Improve Prettified Vue code

This commit is contained in:
Jérémie Astori 2019-02-17 02:59:11 -05:00 committed by Alistair McKinlay
parent 133e7bf710
commit 2fbdbead55

View File

@ -119,23 +119,22 @@ export default {
return; return;
} }
if (this.channel.inputHistoryPosition === 0) { const {channel} = this;
this.channel.inputHistory[
this.channel.inputHistoryPosition if (channel.inputHistoryPosition === 0) {
] = this.channel.pendingMessage; channel.inputHistory[channel.inputHistoryPosition] = channel.pendingMessage;
} }
if (key === "up") { if (key === "up") {
if (this.channel.inputHistoryPosition < this.channel.inputHistory.length - 1) { if (channel.inputHistoryPosition < channel.inputHistory.length - 1) {
this.channel.inputHistoryPosition++; channel.inputHistoryPosition++;
} }
} else if (this.channel.inputHistoryPosition > 0) { } else if (channel.inputHistoryPosition > 0) {
this.channel.inputHistoryPosition--; channel.inputHistoryPosition--;
} }
this.channel.pendingMessage = this.$refs.input.value = this.channel.inputHistory[ channel.pendingMessage = channel.inputHistory[channel.inputHistoryPosition];
this.channel.inputHistoryPosition this.$refs.input.value = channel.pendingMessage;
];
this.setInputSize(); this.setInputSize();
return false; return false;