[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    PATCH for KWrite
From:       Maniac <Maniac () alltel ! net>
Date:       2000-10-06 0:03:49
[Download RAW message or body]

Hello

Would some one please test this patch and give me some feedback
It seems to speed up KWrite on my system.

And please be gentle )

-- 
Maniac@alltel.net  40.619302 N, 96.956676 W
A single tasking guy in multi tasking world.

["highlight.diff" (text/x-c++)]

Index: highlight.cpp
===================================================================
RCS file: /home/kde/kdebase/kwrite/highlight.cpp,v
retrieving revision 1.79
diff -u -3 -p -r1.79 highlight.cpp
--- highlight.cpp	2000/08/26 13:45:52	1.79
+++ highlight.cpp	2000/10/05 23:53:02
@@ -284,6 +284,7 @@ KeywordData::~KeywordData() {
 HlKeyword::HlKeyword(int attribute, int context)
   : HlItemWw(attribute,context) {
 //  words.setAutoDelete(true);
+	Words.resize(100);
 }
 
 HlKeyword::~HlKeyword() {
@@ -298,21 +299,33 @@ void HlKeyword::addWord(const QString &w
 
 void HlKeyword::addList(const char **list) {
 
+	static uint i=0;
   while (*list) {
     words.append(*list);
+    if(i>=Words.size()) Words.resize(Words.size()+10);
+		Words.insert(i++,*list);
 //    addWord(*list);
     list++;
   }
+	Words.sort();
 }
 
 const QChar *HlKeyword::checkHgl(const QChar *s) {
-
+#if 0
   for (QStringList::Iterator it = words.begin(); it != words.end(); ++it) {
     if (memcmp(s, (*it).unicode(), (*it).length()*sizeof(QChar)) == 0) {
       return s + (*it).length();
     }
   }
   return 0L;
+#else
+	const QChar *s2=s;
+	while(!s2->isSpace()&& !s2->isNull()) s2++;
+	QString wrd(s,s2-s);wrd+=QChar('\0');
+	int found=Words.bsearch(wrd.latin1());	
+	if(found > -1 ) return s2;
+	return 0L;
+#endif
 }
 
 
Index: highlight.h
===================================================================
RCS file: /home/kde/kdebase/kwrite/highlight.h,v
retrieving revision 1.42
diff -u -3 -p -r1.42 highlight.h
--- highlight.h	2000/07/23 18:15:39	1.42
+++ highlight.h	2000/10/05 23:55:43
@@ -25,7 +25,7 @@
 
 #include <qlist.h>
 #include <qdialog.h>
-
+#include <qstrvec.h>
 #include <kcolorbtn.h>
 
 class QCheckBox;
@@ -108,6 +108,7 @@ class HlKeyword : public HlItemWw {
     virtual const QChar *checkHgl(const QChar *);
   protected:
     QStringList words;
+		QStrVec Words;
 };
 
 class HlInt : public HlItemWw {

>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic