diff options
| author | 2010-03-24 18:27:52 +0000 | |
|---|---|---|
| committer | 2010-03-24 18:27:52 +0000 | |
| commit | 0f4e17f73dda813582dbbbabb70a9be05c7d5f3c (patch) | |
| tree | 73fd1efd118dd586a8a44d7b33e8f938f6ba85bc | |
| parent | More work on classeditor (diff) | |
| download | KVIrc-0f4e17f73dda813582dbbbabb70a9be05c7d5f3c.tar.gz KVIrc-0f4e17f73dda813582dbbbabb70a9be05c7d5f3c.tar.bz2 KVIrc-0f4e17f73dda813582dbbbabb70a9be05c7d5f3c.zip | |
Fixed an infinite loop in syntax highlighter when search for text
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4213 17fca916-40b9-46aa-a4ea-0a15b648b75c
| -rw-r--r-- | src/modules/editor/scripteditor.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/modules/editor/scripteditor.cpp b/src/modules/editor/scripteditor.cpp index 1f56c214c..7d62f2fc9 100644 --- a/src/modules/editor/scripteditor.cpp +++ b/src/modules/editor/scripteditor.cpp @@ -679,17 +679,19 @@ void KviScriptEditorSyntaxHighlighter::highlightBlock(const QString & szText) // 'found matches' highlighting KviScriptEditorWidget * pEditor = ((KviScriptEditorWidget *)textEdit()); QString szFind = pEditor->m_szFind; + debug("find %s",szFind.toUtf8().data()); + if (!szFind.isEmpty()) { - QRegExp regFind(szFind); - index = szText.indexOf(regFind); + index = szText.indexOf(szFind); + int length=szFind.length(); while (index >= 0) { - int length = regFind.matchedLength(); setFormat(index, length, findFormat); - index = szText.indexOf(regFind, index + length); + index = szText.indexOf(szFind,index + length); } } + debug("exit loop"); } |
