From 0f4e17f73dda813582dbbbabb70a9be05c7d5f3c Mon Sep 17 00:00:00 2001 From: Noldor Date: Wed, 24 Mar 2010 18:27:52 +0000 Subject: 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 --- src/modules/editor/scripteditor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/modules/editor/scripteditor.cpp') 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"); } -- cgit v1.3.1-10-gc9f91