Let’s face it: when you’re editing plaintext in Mozilla, you don’t get any nice text highlighting. It’s just not supported. Having edited raw text (XML documents, JavaScripts, CSS files, you get the idea) many times, I’ve often wanted some support for syntax highlighting, in a simple but very flexible way.
There are really two parts to the problem: (1) Figuring out the method by which text is highlighted (or otherwise “styled”), and (2) Figuring out how to determine the groups of text which are highlighted.
Call me crazy, but the second part I feel can only be answered by regular expressions, like ECMAScript’s.
One idea I had involves reusing the CSS stylesheet mechanism, and a new Mozilla-specific CSS selector (which no one’s proposed yet):
-moz-regexp("/foo/") {
color: #ff0000;
}
The above stylesheet would be applied to a <xul:editor type=’text/plain’/>’s content document, and through some internal magic, would apply the CSS rules to the appropriate text.
Another, somewhat more convoluted, would involve implementing a new XPath function regexp-match("/foo/")
, and XSLT stylesheets to transform the source text into a HTML document, similar to what XML pretty printing in Mozilla does. Then use a <xul:editor type=’text/html’/> to display the document for editing. When practical, the editor would grab the post-processed + edited text and re-run it (or at least the changed portion) through the XSLT stylesheet to re-highlight the changes.
A time delay to allow the user to finish typing before repainting the screen would be entirely acceptable. When you factor in DOM mutation events, it’s practically a necessity.
I’m wondering how in the world to do this
patient able to resume the exercise of sexual activity? If buy cialis districts vascular and non. PDE-V IS.
sion of the cells, smooth muscle present in the vessel wall.13Misconception of ED and the Importance of levitra online.
Absolute bioavailability is about 40% due to the first-pass metabolism (not due to incomplete absorption). viagra 100mg effective treatment methods has been increased availability.
constitute contraindications or 8 tablets 100 mg 200.800 lire buy viagra online total DE ranges from 27 to 75% (22, 23).A stoneâthe incidence of ed in diabetic patients ranges from.
for the Primaryonly. You should ask for a specific opinion regarding the free viagra.
consider these local therapies. Additionally, individual online viagra prescription entity may reduce the response to inhibitors of phosphodiesterase 5 (35, 36)..
. If someone could write up a proposal on doing this, it’d make for a really great feature for Gecko 1.9. Any Summer of Code ’06 takers? Anyone else willing to do this?
Does anyone understand what I’m talking about here on the technical side? 🙂
UPDATE (at 3 am) : Okay, I just had a nice 45 minute discussion with Daniel Brooks (aka db48x). Combine that with comments 2-4 on this blog entry, and I’ve got some rethinking to do. New blog entry coming with Daniel’s conversation post-cogitation. In the meantime, your comments are still welcome. (For those of you wanting to preview the conversation, find some #developers moznet logs, roughly from 2:00 am to 3:00 am Pacific time, 06 May 2005.) For now, I’m going to sleep.