Fwd: kdevelop kwrite faster Syntaxhighlighting done.

Sandy Meier smeier at kdevelop.org
Mon Dec 4 13:40:36 UTC 2000


I got following email. Maybe someone with more experience in KWrite can 
review this patch?


----------  Forwarded Message  ----------
Subject: kdevelop kwrite faster Syntaxhighlighting done.
Date: Sat, 2 Dec 2000 12:50:40 +0100
From: <berndroesch at gmx.de>
To: <smeier at rz.uni-potsdam.de>

here is 7 * faster Syntaxhighlighting with little Changes.
I hope i have the right e-mail for changes in kdevelop/kwrite.If not and if
 you know the right address please mail me the correct address.Many Thanks.
With this changes doHighlight is only called for the visible lines.In uae
 compemu.c with 51000 Lines loading or displaying in debugger take without
 Patch 12 sec with Patch 1.8 sec.Switching between kview and kdoc take
 without Patch 3 sec with not mesurable;

The changes are easy so no patch file is requered.

in file: kdevelop/kwrite/kwdoc.cpp
Insert Global Definition: Highlight *highlightstore;
in Class: KWriteDoc::updateLines(int startLine, int endLine, int flags) {
replace line: ctxNum = highlight->doHighlight(ctxNum,textLine);
with: if(endLine-line<4)ctxNum = highlight->doHighlight(ctxNum,textLine);
in file: kdevelop/kwrite/kwview.cpp
in Class: void KWriteView::paintEvent(QPaintEvent *e) {
after: while (y < yEnd)
insert this:
TextLine *textLine;
extern Highlight *highlightstore;
int ctxNum = 0;
if ((kWriteDoc->getTextLineCount()-1)>line){
    textLine = kWriteDoc->textLine(line);
    if (line > 0) ctxNum = kWriteDoc->textLine(line - 1)->getContext();
    ctxNum = highlightstore->doHighlight(ctxNum,textLine);
**** stop
highlightstore is need because i dont know how i can access highlight from
 kview Class. I think the programmer of kwrite change this faster than I so I
 search no longer because it work so.Please send back problems suggestions to
  berndroesch at gmx.de.I have also a idea for global Bookmarks(Bookmark marked
 in text with   //!!Bookmark).So easy add a second grep window with search
 for / /!!%s.I have only added / /!!%s to the template Listbox but it is
 better to use a second window.
I dont know any about qt so let me know if someone is interresting  to do
 that in the best Unix IDE.


Until he extends the circle of compassion to all living things, 
man will not himself find peace. (Albert Schweitzer)

to unsubscribe from this list send an email to kdevelop-devel-request at kdevelop.org with the following body:
unsubscribe »your-email-address«

More information about the KDevelop-devel mailing list