Add tabcompletion for PMs

This commit is contained in:
kr4ssi@tuta.io 2020-03-14 01:43:25 +01:00 committed by Calvin Montgomery
parent 106065184f
commit d2358924a4
2 changed files with 11 additions and 4 deletions

View File

@ -122,12 +122,11 @@ CyTube.chatTabCompleteData = {
context: {}
};
function chatTabComplete() {
function chatTabComplete(chatline) {
if (!CyTube.tabCompleteMethods) {
console.error('Missing CyTube.tabCompleteMethods!');
return;
}
var chatline = document.getElementById("chatline");
var currentText = chatline.value;
var currentPosition = chatline.selectionEnd;
if (typeof currentPosition !== 'number' || !chatline.setSelectionRange) {
@ -199,7 +198,7 @@ $("#chatline").keydown(function(ev) {
}
else if(ev.keyCode == 9) { // Tab completion
try {
chatTabComplete();
chatTabComplete(ev.target);
} catch (error) {
console.error(error);
}

View File

@ -776,7 +776,7 @@ function applyOpts() {
else {
USEROPTS.notifications = "never";
}
}
}
}
function parseTimeout(t) {
@ -2814,6 +2814,14 @@ function initPm(user) {
meta: meta
});
input.val("");
} else if(ev.keyCode == 9) { // Tab completion
try {
chatTabComplete(ev.target);
} catch (error) {
console.error(error);
}
ev.preventDefault();
return false;
}
});