QuIRC's Nick Complete.

This document completely explains quirc's advanced nick complete engine.

It is activated by using the <tab> key in any window in quirc, the effect varying on what type of window it is pressed in.

The token it uses for completetion is based on cursor position.  QuIRC scans forward and backward from the current position until a space or the end/start of the entry box is encountered.  Thus the token may be anywhere in the entry box, it could be the first word a middle word or the last word.  The cursor may also be positioned anywhere within the, word including right before and right after it.

Channel Window

When tab is pressed the token will be compared to all nicks in the nicklist of the current channel.

Case 1: The token matches 1 nick only.

This nick will be returned.

Case 2: The token matches several nicks but only one of the nicks is matched from first character.

The nick that is matched from its start is returned.
eg:
Nicklist = Bob, Robot
Token = Bo

Bo matches both words but Bob is matched from the start so only it is returned.

Case 3: More than one match is encountered.

The nick complete engine will expand the token as much as possible so that it still matches all the nicks.

eg:
Nicklist = Batman, Batwoman, He-man.
Token = B

The engine will return Bat, and further presses of tab will cycle between the two nicks Batman and Batwoman.

Note this similar situation demonstrating the internal comparison of nicks.

Nicklist = Batman, Batwoman, He-man.
Token = N

The engine would return "man", and would cycle through all three nicks.

Another example:

Nicklist = Batman, Batwoman, Vampirebat.
Token = B

The engine would match all three nicks and expand to Bat, but it will only cycle between batwoman and batman because they are matched at the start.

The next type of completion within channels is the channel name complete.  For this type of completion to occur the token must begin with "#".

Case 1: The token is just "#"

The current channel name is returned.

Case 2: The token "#<some chars>" matches one channel name.

That channel is returned.

Case 3: The token "#<some chars>" matches more than one channel name.

The token is expanded as much as possible and then will cycle through the matching channels.

The channel name completion works in any window but the token "#" matches all channels instead of the current one (Because there is no current one if you're not in a channel window)


Query Window.
The engine behaves the same as a channel window except the nick list is your nick and the person you are in the query with.  It also defaults to their nick if you complete on an empty token.

Dcc Chat Window.
Identical to the query window.

Server Status Window.
Completion will evaluate to your nick.
