mirror of
https://github.com/hack-chat/main.git
synced 2024-03-22 13:20:33 +08:00
Merge pull request #58 from MinusGix/patch-3
Pressing Tab inserts a Tab Character
This commit is contained in:
commit
febc9ba744
|
@ -402,6 +402,8 @@ $('#chatinput').onkeydown = function (e) {
|
||||||
var text = e.target.value;
|
var text = e.target.value;
|
||||||
var index = text.lastIndexOf('@', pos);
|
var index = text.lastIndexOf('@', pos);
|
||||||
|
|
||||||
|
var autocompletedNick = false;
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
var stub = text.substring(index + 1, pos).toLowerCase();
|
var stub = text.substring(index + 1, pos).toLowerCase();
|
||||||
// Search for nick beginning with stub
|
// Search for nick beginning with stub
|
||||||
|
@ -411,8 +413,14 @@ $('#chatinput').onkeydown = function (e) {
|
||||||
|
|
||||||
if (nicks.length == 1) {
|
if (nicks.length == 1) {
|
||||||
insertAtCursor(nicks[0].substr(stub.length) + " ");
|
insertAtCursor(nicks[0].substr(stub.length) + " ");
|
||||||
|
autocompletedNick = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since we did not insert a nick, we insert a tab character
|
||||||
|
if (!autocompletedNick) {
|
||||||
|
insertAtCursor('\t');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user