damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.44k stars 800 forks source link

Add syntax highlighting to editor #270

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

Syntax highlighting for languages would make the editor more useful.

Original issue reported on code.google.com by damonkoh...@gmail.com on 4 Mar 2010 at 3:25

Copied from original issue: damonkohler/android-scripting#211

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

If you are going to do this then can you also do the auto indent and 
potentially 
make switch offable the word wrap in portrait mode.

Original comment by Panquisitive on 9 Mar 2010 at 6:18

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

Does this include syntax checking as well

Original comment by Panquisitive on 16 Mar 2010 at 5:57

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

Original comment by damonkoh...@gmail.com on 22 Mar 2010 at 4:23

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

Why not use "TouchQode"
You can find it in the Google Market

Original comment by tony537...@gmail.com on 9 Jul 2011 at 6:56

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

Interface is far from perfect but the program is really interesting,
i'll give it a try some days :-)

Original comment by piranna on 10 Jul 2011 at 2:33

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

A straightforward/naive implementation using spannable seems to become unusable 
after around 350 coloured tokens, with almost all of the time spent in setSpan 
and removeSpan. In addition, scrolling performance becomes very bad. Parsing 
time is negligible (with regexes).
Is it better to override the drawing code to improve the performance (since the 
highlighting doesn't need to be stored) or to keep track of code insertions and 
deletions to avoid removing and setting all the spans?

Original comment by ying...@gmail.com on 20 Jan 2012 at 5:09

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

I think in a first step is better to check only the insertions and
deletions.

Sended from my Android cell phone, please sorry the lack of format on the
text and my fat thumbs :-P
El 20/01/2012 06:10, <android-scripting@googlecode.com> escribi�:

Original comment by piranna on 20 Jan 2012 at 6:42

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

Well the parsing is fast, it's just the span logic that seems slow. I've 
already tried the obvious steps like (?:)+. It's possible to use touchqode's 
approach of only highlighting (longer) words (limiting the bumber of spans) 
although I don't even know if it uses spans.

Original comment by ying...@gmail.com on 20 Jan 2012 at 11:02

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

Maybe it's overkilling... but if performance is such a problem, since it's
only highlighting and not changing font or size, why don't get marks of
current visible text and only render that?

Sended from my Android cell phone, please sorry the lack of format on the
text and my fat thumbs :-P
El 21/01/2012 00:03, <android-scripting@googlecode.com> escribi�:

Original comment by piranna on 20 Jan 2012 at 11:26

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:25

I tried just a naive implementation. However, one token-filled screen could be 
slow. I'm not sure about this, but I think complete updates while scrolling 
might feel even worse. However, incremental ones would probably be fine. I'm 
not exactly sure how to do this, though. I think a fenwick tree and tracking 
text changes is the way to go.

Original comment by ying...@gmail.com on 20 Jan 2012 at 11:38