Permalink
Browse files

Add option to ignore special characters in nick completion.

Implements #794
  • Loading branch information...
IceN9ne committed Sep 14, 2016
1 parent eba8776 commit 379f9b8f65fa479490af45b2f469eb731cff9c0e
@@ -332,7 +332,8 @@ KviBoolOption g_boolOptionsTable[KVI_NUM_BOOL_OPTIONS] = {
BOOL_OPTION("ShowTreeWindowListHandle", true, KviOption_sectFlagWindowList | KviOption_resetUpdateGui | KviOption_groupTheme),
BOOL_OPTION("MenuBarVisible", true, KviOption_sectFlagFrame | KviOption_resetUpdateGui),
BOOL_OPTION("WarnAboutHidingMenuBar", true, KviOption_sectFlagFrame),
BOOL_OPTION("WhoRepliesToActiveWindow", false, KviOption_sectFlagConnection)
BOOL_OPTION("WhoRepliesToActiveWindow", false, KviOption_sectFlagConnection),
BOOL_OPTION("IgnoreSpecialCharactersInNickCompletion", false, KviOption_sectFlagInput)

This comment has been minimized.

Show comment
Hide comment
@un1versal

un1versal Sep 14, 2016

Contributor

it does say to reuse unused entries before adding new ones

@un1versal

un1versal Sep 14, 2016

Contributor

it does say to reuse unused entries before adding new ones

This comment has been minimized.

Show comment
Hide comment
@staticfox

staticfox Sep 14, 2016

Member

That comment is old. You decided to delete all the unused ones so it is no longer valid.

@staticfox

staticfox Sep 14, 2016

Member

That comment is old. You decided to delete all the unused ones so it is no longer valid.

This comment has been minimized.

Show comment
Hide comment
@un1versal
@un1versal

un1versal Sep 14, 2016

Contributor
};
// NOTICE: REUSE EQUIVALENT UNUSED KviOption_bool in KviOptions.h ENTRIES BEFORE ADDING NEW ENTRIES ABOVE
@@ -353,10 +353,11 @@ DECLARE_OPTION_STRUCT(KviStringListOption, QStringList)
#define KviOption_boolMenuBarVisible 261
#define KviOption_boolWarnAboutHidingMenuBar 262
#define KviOption_boolWhoRepliesToActiveWindow 263 /* irc::output */
#define KviOption_boolIgnoreSpecialCharactersInNickCompletion 264 /* input */
// NOTICE: REUSE EQUIVALENT UNUSED BOOL_OPTION in KviOptions.cpp ENTRIES BEFORE ADDING NEW ENTRIES ABOVE
#define KVI_NUM_BOOL_OPTIONS 264
#define KVI_NUM_BOOL_OPTIONS 265
#define KVI_STRING_OPTIONS_PREFIX "string"
#define KVI_STRING_OPTIONS_PREFIX_LEN 6
@@ -55,6 +55,7 @@
#include <QEvent>
#include <QPaintEvent>
#include <QScrollBar>
#include <QRegExp>
#ifdef COMPILE_PSEUDO_TRANSPARENCY
extern QPixmap * g_pShadedChildGlobalDesktopBackground;
@@ -463,10 +464,17 @@ void KviUserListView::animatedAvatarUpdated(KviUserListEntry * e)
void KviUserListView::completeNickBashLike(const QString & szBegin, std::vector<QString> & pList, bool bAppendMask)
{
KviUserListEntry * pEntry = m_pHeadItem;
while(pEntry)
{
if(KviQString::equalCIN(szBegin, pEntry->m_szNick, szBegin.length()))
bool bEqual = KviQString::equalCIN(szBegin, pEntry->m_szNick, szBegin.length());
if(!bEqual && KVI_OPTION_BOOL(KviOption_boolIgnoreSpecialCharactersInNickCompletion))
{
QString szTmp = pEntry->m_szNick;
szTmp.remove(QRegExp("[^a-zA-Z0-9]"));
bEqual = KviQString::equalCIN(szBegin, szTmp, szBegin.length());
}
if(bEqual)
{
if(bAppendMask)
pList.push_back(QString("%1!%2@%3").arg(pEntry->m_szNick, pEntry->m_pGlobalData->user(), pEntry->m_pGlobalData->host()));
@@ -506,8 +514,15 @@ bool KviUserListView::completeNickStandard(const QString & szBegin, const QStrin
{
if(pEntry->m_szNick.length() >= szBegin.length())
{
int iResult = KviQString::cmpCIN(szBegin, pEntry->m_szNick, szBegin.length());
if(iResult == 0)
bool bEqual = KviQString::equalCIN(szBegin, pEntry->m_szNick, szBegin.length());
if(!bEqual && KVI_OPTION_BOOL(KviOption_boolIgnoreSpecialCharactersInNickCompletion))
{
QString szTmp = pEntry->m_szNick;
szTmp.remove(QRegExp("[^a-zA-Z0-9]"));
bEqual = KviQString::equalCIN(szBegin, szTmp, szBegin.length());
}
if(bEqual)
{
// This is ok.
szBuffer = pEntry->m_szNick;
@@ -157,6 +157,8 @@ OptionsWidget_inputFeatures::OptionsWidget_inputFeatures(QWidget * parent)
addStringSelector(g, __tr2qs_ctx("Nick completion postfix string:", "options"), KviOption_stringNickCompletionPostfix);
addBoolSelector(g, __tr2qs_ctx("Use the completion postfix string for the first word only", "options"), KviOption_boolUseNickCompletionPostfixForFirstWordOnly);
addBoolSelector(g, __tr2qs_ctx("Ignore special characters in nick completion", "options"), KviOption_boolIgnoreSpecialCharactersInNickCompletion);
KviBoolSelector * d = addBoolSelector(0, 7, 0, 7, __tr2qs_ctx("Use a custom cursor width", "options"), KviOption_boolEnableCustomCursorWidth);
KviUIntSelector * f = addUIntSelector(0, 8, 0, 8, __tr2qs_ctx("Custom cursor width:", "options"), KviOption_uintCustomCursorWidth, 1, 24, 8, KVI_OPTION_BOOL(KviOption_boolEnableCustomCursorWidth));
f->setSuffix(__tr2qs_ctx(" pixels", "options"));

0 comments on commit 379f9b8

Please sign in to comment.