diff --git a/client/components/ChatInput.vue b/client/components/ChatInput.vue index 874cbe73..56b2c22e 100644 --- a/client/components/ChatInput.vue +++ b/client/components/ChatInput.vue @@ -116,7 +116,7 @@ export default { }); inputTrap.bind(["up", "down"], (e, key) => { - if (e.target.selectionStart !== e.target.selectionEnd) { + if (this.$root.isAutoCompleting || e.target.selectionStart !== e.target.selectionEnd) { return; } diff --git a/client/js/autocompletion.js b/client/js/autocompletion.js index 89b159ac..a645970c 100644 --- a/client/js/autocompletion.js +++ b/client/js/autocompletion.js @@ -21,6 +21,7 @@ module.exports = { Mousetrap(input.get(0)).unbind("tab", "keydown"); textcomplete.destroy(); enabled = false; + vueApp.isAutoCompleting = false; } }, }; @@ -169,7 +170,6 @@ const backgroundColorStrategy = { function enableAutocomplete(inputRef) { enabled = true; - let autocompleting = false; let tabCount = 0; let lastMatch = ""; let currentMatches = []; @@ -186,7 +186,7 @@ function enableAutocomplete(inputRef) { }); Mousetrap(input.get(0)).bind("tab", (e) => { - if (autocompleting) { + if (vueApp.isAutoCompleting) { return; } @@ -252,11 +252,11 @@ function enableAutocomplete(inputRef) { }); textcomplete.on("show", () => { - autocompleting = true; + vueApp.isAutoCompleting = true; }); textcomplete.on("hidden", () => { - autocompleting = false; + vueApp.isAutoCompleting = false; }); $("#form").on("submit.tabcomplete", () => { diff --git a/client/js/vue.js b/client/js/vue.js index 9107760c..ce5c4783 100644 --- a/client/js/vue.js +++ b/client/js/vue.js @@ -26,6 +26,7 @@ const vueApp = new Vue({ connectionError: false, fileUploadEnabled: false, isNotified: false, + isAutoCompleting: false, appName: document.title, activeChannel: null, networks: [],