aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2019-04-11 01:42:30 +0200
committerGitHub <noreply@github.com>2019-04-11 01:42:30 +0200
commitfebc9ba7440e974e3a296182e23e9bf4d8df2e4f (patch)
tree9182e9bbf06a8981d5c35df228eb968834e0b0f0
parentrefactoring 2 of 2 (diff)
parentPressing Tab inserts a Tab Character (diff)
downloadhackchat-febc9ba7440e974e3a296182e23e9bf4d8df2e4f.tar.gz
hackchat-febc9ba7440e974e3a296182e23e9bf4d8df2e4f.zip
Merge pull request #58 from MinusGix/patch-3
Pressing Tab inserts a Tab Character
-rw-r--r--client/client.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/client/client.js b/client/client.js
index 380318e..4f77450 100644
--- a/client/client.js
+++ b/client/client.js
@@ -401,6 +401,8 @@ $('#chatinput').onkeydown = function (e) {
var pos = e.target.selectionStart || 0;
var text = e.target.value;
var index = text.lastIndexOf('@', pos);
+
+ var autocompletedNick = false;
if (index >= 0) {
var stub = text.substring(index + 1, pos).toLowerCase();
@@ -411,8 +413,14 @@ $('#chatinput').onkeydown = function (e) {
if (nicks.length == 1) {
insertAtCursor(nicks[0].substr(stub.length) + " ");
+ autocompletedNick = true;
}
}
+
+ // Since we did not insert a nick, we insert a tab character
+ if (!autocompletedNick) {
+ insertAtCursor('\t');
+ }
}
}