Do not navigate history when autocompleting

This commit is contained in:
Pavel Djundik 2018-09-09 16:03:37 +03:00
parent 4c103b467b
commit f526aa8b8b
3 changed files with 6 additions and 5 deletions

View file

@ -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;
}

View file

@ -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", () => {

View file

@ -26,6 +26,7 @@ const vueApp = new Vue({
connectionError: false,
fileUploadEnabled: false,
isNotified: false,
isAutoCompleting: false,
appName: document.title,
activeChannel: null,
networks: [],