[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [konversation] src/irc: Fix completion for the case (nick<tab>
From: Peter Simonsson <peter.simonsson () gmail ! com>
Date: 2016-09-14 17:08:09
Message-ID: E1bkDfN-0008IP-Js () code ! kde ! org
[Download RAW message or body]
Git commit 9532fc0eeae7ff32a20ec8349e6f5850396aca43 by Peter Simonsson.
Committed on 14/09/2016 at 17:07.
Pushed by psn into branch 'master'.
Fix completion for the case (nick<tab>
Initial fix by: mayank jha
Cleaned up and improved by me.
M +15 -2 src/irc/channel.cpp
http://commits.kde.org/konversation/9532fc0eeae7ff32a20ec8349e6f5850396aca43
diff --git a/src/irc/channel.cpp b/src/irc/channel.cpp
index acd40b6..0333638 100644
--- a/src/irc/channel.cpp
+++ b/src/irc/channel.cpp
@@ -28,6 +28,7 @@
#include "notificationhandler.h"
#include "viewcontainer.h"
+#include <QRegExp>
#include <QSplitter>
#include <QTimer>
#include <QToolButton>
@@ -529,8 +530,20 @@ void Channel::completeNick()
m_inputBar->setOldCursorPosition(pos);
// remember old cursor position locally
oldPos = pos;
- // step back to last space or start of line
- while(pos && line[pos-1] != QLatin1Char(' ')) pos--;
+ // step back to []{}-_^`\| or start of line
+ QString regexpStr("[^A-Z0-9a-z\\_\\[\\]\\{\\}\\-\\^\\`\\\\\\|");
+
+ if(!Preferences::self()->prefixCharacter().isEmpty())
+ regexpStr += "\\" + Preferences::self()->prefixCharacter();
+
+ regexpStr += QLatin1Char(']');
+ QRegExp tmp(regexpStr);
+ pos = tmp.lastIndexIn(line, pos - 1);
+ if (pos < 0)
+ pos = 0;
+ else
+ pos++;
+ qDebug() << line << pos << tmp.matchedLength();
// copy search pattern (lowercase)
QString pattern = line.mid(pos, oldPos - pos);
// copy line to newLine-buffer
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic