[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-edu-devel
Subject: Re: [kde-edu]: Review Request: Syntax Hightlighting in Cantor
From: "Miha Cancula" <miha.cancula () gmail ! com>
Date: 2010-08-26 14:31:53
Message-ID: 20100826143153.25309.85714 () vidsolbach ! de
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On 2010-08-24 21:07:46, Alexander Rieder wrote:
> > looks good to me.
> > btw. I mailed Oleksiy about this patch and asked him to have a look at =
it too.
I went ahead and committed this change. =
If Oleksiy finds any issues/improvements we can always change it in svn.
- Miha
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/5079/#review7203
-----------------------------------------------------------
On 2010-08-24 19:44:58, Miha Cancula wrote:
> =
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/5079/
> -----------------------------------------------------------
> =
> (Updated 2010-08-24 19:44:58)
> =
> =
> Review request for KDE-Edu and Alexander Rieder.
> =
> =
> Summary
> -------
> =
> As discussed on email, I implemented a different approach to highlighting=
in Cantor. I'd like some feedback before committing it. =
> =
> I introduced additional API in DefaultHighlighter and moved most of the l=
ogic in it, so the individual backend-specific highlighters only specify co=
nditions (either QString or QRegExp) and matching text formats. The code lo=
oks much cleaner this way.
> =
> As Alexander and Oleksiy already determined, breaking the text into words=
and looking for these words is faster than iterating over a huge list of r=
egexes and looking for each of them in the text. That's why functions, vari=
ables and keywords are implemented this way. OTOH, thing like comments and =
strings are easier done using Regexes, so this functionality is still there=
. =
> =
> The implementation uses a QHash<QString, QTextCharFormat> and a QHash<QRe=
gExp, QTextCharFormat>. If anyone knows of a way to make it faster, please =
say so. =
> =
> I also updated highlighters for Octave, Maxima and Sage to use the word-b=
ased API as much as possible. Most of their code was also removed, because =
it's now in DefaultHighlighter. I left R alone because Oleksiy's work is no=
t yet in trunk. =
> =
> =
> Diffs
> -----
> =
> /trunk/KDE/kdeedu/cantor/src/backends/maxima/maximahighlighter.h 116676=
2 =
> /trunk/KDE/kdeedu/cantor/src/backends/maxima/maximahighlighter.cpp 1166=
762 =
> /trunk/KDE/kdeedu/cantor/src/backends/octave/octavehighlighter.h 116676=
2 =
> /trunk/KDE/kdeedu/cantor/src/backends/octave/octavehighlighter.cpp 1166=
762 =
> /trunk/KDE/kdeedu/cantor/src/backends/sage/sagehighlighter.h 1166762 =
> /trunk/KDE/kdeedu/cantor/src/backends/sage/sagehighlighter.cpp 1166762 =
> /trunk/KDE/kdeedu/cantor/src/lib/defaulthighlighter.h 1166762 =
> /trunk/KDE/kdeedu/cantor/src/lib/defaulthighlighter.cpp 1166762 =
> =
> Diff: http://reviewboard.kde.org/r/5079/diff
> =
> =
> Testing
> -------
> =
> I tested Maxima and Sage and they seem to be faster than before for large=
blocks. I used to have problems with non-smooth scrolling in Octave due to=
the large number of functions, but now it feels normal. I didn't notice an=
y regressions (yet). =
> =
> It all works both on trunk and 4.4. =
> =
> =
> Thanks,
> =
> Miha
> =
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://reviewboard.kde.org/r/5079/">http://reviewboard.kde.org/r/5079/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;"> <p style="margin-top: 0;">On August 24th, 2010, 9:07 p.m., <b>Alexander \
Rieder</b> wrote:</p> <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;"> <pre style="white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">looks good to me. btw. I mailed Oleksiy about this patch and asked him \
to have a look at it too.</pre> </blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I went ahead and \
committed this change. If Oleksiy finds any issues/improvements we can always change \
it in svn.</pre> <br />
<p>- Miha</p>
<br />
<p>On August 24th, 2010, 7:44 p.m., Miha Cancula wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for KDE-Edu and Alexander Rieder.</div>
<div>By Miha Cancula.</div>
<p style="color: grey;"><i>Updated 2010-08-24 19:44:58</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">As discussed on email, I implemented a different approach to \
highlighting in Cantor. I'd like some feedback before committing it.
I introduced additional API in DefaultHighlighter and moved most of the logic in it, \
so the individual backend-specific highlighters only specify conditions (either \
QString or QRegExp) and matching text formats. The code looks much cleaner this way.
As Alexander and Oleksiy already determined, breaking the text into words and looking \
for these words is faster than iterating over a huge list of regexes and looking for \
each of them in the text. That's why functions, variables and keywords are \
implemented this way. OTOH, thing like comments and strings are easier done using \
Regexes, so this functionality is still there.
The implementation uses a QHash<QString, QTextCharFormat> and a \
QHash<QRegExp, QTextCharFormat>. If anyone knows of a way to make it faster, \
please say so.
I also updated highlighters for Octave, Maxima and Sage to use the word-based API as \
much as possible. Most of their code was also removed, because it's now in \
DefaultHighlighter. I left R alone because Oleksiy's work is not yet in trunk. \
</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">I tested Maxima and Sage and they seem to be faster than before for \
large blocks. I used to have problems with non-smooth scrolling in Octave due to the \
large number of functions, but now it feels normal. I didn't notice any \
regressions (yet).
It all works both on trunk and 4.4. </pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/KDE/kdeedu/cantor/src/backends/maxima/maximahighlighter.h <span \
style="color: grey">(1166762)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/maxima/maximahighlighter.cpp <span \
style="color: grey">(1166762)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/octave/octavehighlighter.h <span \
style="color: grey">(1166762)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/octave/octavehighlighter.cpp <span \
style="color: grey">(1166762)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/sage/sagehighlighter.h <span style="color: \
grey">(1166762)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/backends/sage/sagehighlighter.cpp <span \
style="color: grey">(1166762)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/lib/defaulthighlighter.h <span style="color: \
grey">(1166762)</span></li>
<li>/trunk/KDE/kdeedu/cantor/src/lib/defaulthighlighter.cpp <span style="color: \
grey">(1166762)</span></li>
</ul>
<p><a href="http://reviewboard.kde.org/r/5079/diff/" style="margin-left: 3em;">View \
Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
_______________________________________________
kde-edu mailing list
kde-edu@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-edu
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic