Closed Bug 955248 Opened 10 years ago Closed 10 years ago

Tab completion for nicks that start with "funny" characters

Categories

(Instantbird Graveyard :: Conversation, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bugzilla, Assigned: aleth)

Details

Attachments

(1 file, 2 obsolete files)

*** Original post on bio 1815 by Douglas Thrift <douglaswth AT gmail.com> at 2012-11-21 19:12:00 UTC ***

In IRC, trying to tab complete the nick "|an" does not do anything although the "|an" nick is online and in the chat.
*** Original post on bio 1815 at 2012-11-21 20:14:47 UTC ***

.
Assignee: nobody → aleth
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
OS: Windows 7 → All
Hardware: x86 → All
Attached patch Patch (obsolete) — Splinter Review
*** Original post on bio 1815 as attmnt 2118 at 2012-11-21 21:59:00 UTC ***

This bug was due to this regex (which detects the word the cursor is in) not matching at all when the "word" starts with special characters.

NB Tab completion in general supports nicks with leading special characters, but is a bit conservative when it comes to special characters in the middle of nicks.
Attachment #8353879 - Flags: review?(florian)
*** Original post on bio 1815 at 2012-11-21 22:13:59 UTC ***

To be clear: "not matching at all" led to a TypeError which broke tab completion.
Attached patch Alternative patch (obsolete) — Splinter Review
*** Original post on bio 1815 as attmnt 2119 at 2012-11-21 22:44:00 UTC ***

Here's an alternative solution for this code. I prefer it because it does without the regex and works for all possible nicks, even those containing special characters in odd (non-leading) places.
Attachment #8353880 - Flags: review?(florian)
Comment on attachment 8353879 [details] [diff] [review]
Patch

*** Original change on bio 1815 attmnt 2118 at 2012-11-22 00:01:46 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353879 - Attachment is obsolete: true
Attachment #8353879 - Flags: review?(florian)
Comment on attachment 8353880 [details] [diff] [review]
Alternative patch

*** Original change on bio 1815 attmnt 2119 at 2012-11-22 00:04:11 UTC ***

Looks ok.

>diff --git a/chrome/instantbird/content/instantbird/conversation.xml b/chrome/instantbird/content/instantbird/conversation.xml

>+          for (let i = 0; i < matchingCompletions.length; ++i) {
>+            if (wholeWord.lastIndexOf(matchingCompletions[i], 0) == 0) {
>+              inputBox.selectionStart += matchingCompletions[i].length - word.length;

Nit: Why not: for each (let completion in matchingCompletions) ?
Attachment #8353880 - Flags: feedback+
Attached patch PatchSplinter Review
*** Original post on bio 1815 as attmnt 2121 at 2012-11-22 13:28:00 UTC ***

Right, much better.
Attachment #8353882 - Flags: review?(florian)
Comment on attachment 8353880 [details] [diff] [review]
Alternative patch

*** Original change on bio 1815 attmnt 2119 at 2012-11-22 13:28:48 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353880 - Attachment is obsolete: true
Attachment #8353880 - Flags: review?(florian)
Comment on attachment 8353882 [details] [diff] [review]
Patch

*** Original change on bio 1815 attmnt 2121 at 2012-11-24 21:42:36 UTC ***

Thanks.
Attachment #8353882 - Flags: review?(florian) → review+
*** Original post on bio 1815 at 2012-11-25 01:08:53 UTC ***

Fixed in http://hg.instantbird.org/instantbird/rev/d92d61a9b2a3

Thanks!
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4
*** Original post on bio 1815 at 2012-11-25 13:10:46 UTC ***

Thanks for reporting this douglaswth!
You need to log in before you can comment on or make changes to this bug.