Version: 1.3.1 (using KDE 4.5.3) OS: Linux Just now I spent five minutes talking to an absent person on IRC who wasn't even there and felt stupid afterwards. It's Konversation's fault :P Reproducible: Always Steps to Reproduce: 1. Wait for a person to leave a channel you're watching. 2. If he was the last poster, press <TAB> Actual Results: Konversation auto-completes his nickname even though he's absent from the channel. Expected Results: Either auto-complete the next-to-last message's author or (preferably) refuse to auto-complete at all. OS: Linux (i686) release 2.6.36-zen1-20101109-stable-00321-g32771c4 Compiler: gcc
commit 0078505c526d2d04a07b3f666a61d0a2a53656e5 branch master Author: Peter Simonsson <peter.simonsson@gmail.com> Date: Sat Nov 13 19:22:37 2010 +0100 Check if the nick is still around before inserting last completion BUG:256829 diff --git a/src/irc/channel.cpp b/src/irc/channel.cpp index 3d1f6ab..0c63e19 100644 --- a/src/irc/channel.cpp +++ b/src/irc/channel.cpp @@ -502,8 +502,8 @@ void Channel::completeNick() pos = oldPos; } - // If the cursor is at beginning of line, insert last completion - if(pos == 0 && !channelInput->lastCompletion().isEmpty()) + // If the cursor is at beginning of line, insert last completion if the nick is still around + if(pos == 0 && !channelInput->lastCompletion().isEmpty() && nicknameList.containsNick(channelInput->lastCompletion())) { QString addStart(Preferences::self()->nickCompleteSuffixStart()); newLine = channelInput->lastCompletion() + addStart;
Your steps to reproduce are slightly wrong; what's going on is slightly different from what you think is going on. What happens is that <TAB> at the beginning of the line when no prefix has been typed repeats the last successful completion. So there has to have been a successful completion based on a prefix first; whether the person was the last poster or not isn't relevant. Now it's true that while a prefix-based completion obviously operates on the list of nicknames attending a channel at the time, merely repeating the last successful completion by pressing <TAB> without typing a prefix first does not - because in that case, that data isn't actually needed. Repeating the last completion doesn't require a lookup in the nickname list. Whether it *should* check for whether the nickname is still in attendance and do nothing if it isn't is debatable. On the one hand I see your conundrum. On the other hand, the nickname leaving isn't strictly speaking cause to throw away data about the last successful completion. Someone who is familiar with the mechanic might expect it to work regardless of whether the nickname just left or not. Another way to look at it though is that the mechanic is obviously designed with the objective of addressing someone in mind (as evidenced by the fact that it only works on the line start and not mid-line, limiting the sort of sentence structures in which you can tap into it) and once the addressee leaves addressing him or her becomes pointless. So I'd lean toward your "side", but I'm still somewhat unsure. Does anyone else have an opinion?
Well, I guess Peter made up his mind faster ...