Skip to content

Commit

Permalink
Merge pull request #629 from Adamant-im/fix/multiline-bug-in-commands
Browse files Browse the repository at this point in the history
fix: unable to move up/down cursor in a multiline message
  • Loading branch information
bludnic authored Jun 4, 2024
2 parents c97eb2f + 3c2cd1c commit d455086
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/AChat/AChatForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ export default {
if (event.ctrlKey && event.shiftKey && event.code === 'Digit1') {
this.openElement()
} else if (this.isInputFocused && (event.code === 'ArrowUp' || event.code === 'ArrowDown')) {
this.selectCommand(event.code)
event.preventDefault()
this.selectCommand(event)
} else if (event.key.length === 1) {
this.botCommandSelectionMode = false
this.botCommandIndex = null
Expand Down Expand Up @@ -254,13 +253,15 @@ export default {
focus() {
this.$refs.messageTextarea.focus()
},
selectCommand(direction) {
selectCommand(event) {
const direction = event.code
if (!this.message) {
this.botCommandSelectionMode = true
}
if (!this.botCommandSelectionMode) {
return
}
event.preventDefault()
const commands = this.$store.getters['botCommands/getCommandsHistory'](this.partnerId)
const maxIndex = commands.length > 0 ? commands.length - 1 : 0
if (this.botCommandIndex === null) {
Expand Down

0 comments on commit d455086

Please sign in to comment.