Skip to content

Commit

Permalink
Merge pull request #5 from qburst/#5440-fix-up-arrow-key-in-terminal
Browse files Browse the repository at this point in the history
#5440: Fix Up arrow key in terminal
  • Loading branch information
amal-qb committed Mar 19, 2024
2 parents 827595f + 954744f commit fe0ec01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/lib/terminal/Terminal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export default {
data() {
return {
commandText: null,
commands: []
commands: [],
currentCommandIdx: -1
};
},
mounted() {
Expand All @@ -48,6 +49,10 @@ export default {
this.commands.push({ text: this.commandText });
TerminalService.emit('command', this.commandText);
this.commandText = '';
this.currentCommandIdx = this.commands.length - 1;
} else if (event.key === 'ArrowUp' && this.currentCommandIdx > -1) {
this.commandText = this.commands[this.currentCommandIdx].text;
this.currentCommandIdx--;
}
},
responseListener(response) {
Expand Down
6 changes: 6 additions & 0 deletions doc/terminal/AccessibilityDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
</td>
<td>Executes the command when focus in on the input element.</td>
</tr>
<tr>
<td>
<i>up</i>
</td>
<td>Recall previously entered commands to the terminal.</td>
</tr>
</tbody>
</table>
</div>
Expand Down

0 comments on commit fe0ec01

Please sign in to comment.