Thanks, Marco. (See below) > -----Original Message----- > From: Marco Pantaleoni [mailto:[EMAIL PROTECTED]] > Sent: Sunday, June 02, 2002 4:36 PM > To: Palm Developer Forum > Subject: Re: color syntax highlighting on a Palm > <--snippage--> > > No, you don't need to repeat the textual analysis at each > screen redraw > operation. In the worst case you'll have to re-analyze the text only > when it does change. But there are a lot of possible > optimizations: you > can (pre)identify syntactical boundaries and perform the analysis only > within boundaries of the modified portion for example, restricting it > to the visible area, ...
Certainly just the visible area, yes! And I suppose the hit to scrolling performance could be eliminated by analyzing the text only after a certain number of ticks pass between scroll events. No need to see colorized text while it's being scrolled into view--only afterward. > And the naive approach of searching each word in a list of keywords is > a very ingenuous one: an O(n * m) complexity! You can use a smarter > algorithm using hash tables or suffix trees (digital searching), ... Good, glad to be pointed in the direction of some more efficient algorithms! Thanks for the regex links...I'll take it from here. <--more snipping--> > > If you have handy a unix workstation you can also use the > `man' and/or `info' > commands:... Alas, no UNIX box. > > > > > > You can look at the source code of freely available editors > > > implementing > > > syntax highlighting (like jed, vim, emacs, ...) > > > > Any examples of something similar to these written for the > Palm? In addition > > to my concerns about processor-intensive operations on the > Palm, I've only > > been programming C for a few months and mostly just know > the Palm API. Aside > > from that my programming knowledge mostly consists of > scripting languages > > like Javascript and VBScript. > > Perhaps you could start with a less ambitious project then. Writing a > text editor is a difficult task per se, and adding syntax highlighting > only increases the complexity. > Note that the Palm CPU is faster than the ones you could find in many > workstations of some years ago. Writing good code is also a matter > of using the proper algorithms and making good use of available > resources. The text editor is pretty far along (though I can't say this is due in large part to my work) and it already does some parsing of a header file to perform autocompletion. Having a grip on the existing code has emboldened me to try some things I would not otherwise have tried. Even though I don't have much stature as a Palm programmer yet, I feel I can reach higher by standing on the shoulders of some giants. Your warning that maybe I'm over-reaching is duly considered, but I'm not easily daunted! Fortunately, I'm not under any pressure and have the help of others since the project is open source. Thanks again! -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
