From e9bcbf40c5d0172aa3a03b9f7d0ed7a02ff46c43 Mon Sep 17 00:00:00 2001 From: Fmstrat Date: Wed, 20 Nov 2019 13:40:54 -0500 Subject: [PATCH] Check suffix for whitespace on tab completion --- js/irc-utils.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/irc-utils.js b/js/irc-utils.js index ffab2b5..78c207f 100644 --- a/js/irc-utils.js +++ b/js/irc-utils.js @@ -144,7 +144,11 @@ IrcUtils.service('IrcUtils', [function() { if (doIterate) { // try iterating newNick = _nextNick(iterCandidate, m[1], searchNickList); - beforeCaret = newNick + suf + ' '; + if (suf.endsWith(' ')) { + beforeCaret = newNick + suf; + } else { + beforeCaret = newNick + suf + ' '; + } return { text: beforeCaret + afterCaret, caretPos: beforeCaret.length, @@ -166,7 +170,11 @@ IrcUtils.service('IrcUtils', [function() { // no match return ret; } - beforeCaret = newNick + suf + ' '; + if (suf.endsWith(' ')) { + beforeCaret = newNick + suf; + } else { + beforeCaret = newNick + suf + ' '; + } if (afterCaret[0] === ' ') { // swallow first space after caret if any afterCaret = afterCaret.substring(1);