Highlighting through scripts?
@gnachman: "It would be interesting to think about how scripts could orchestrate highlighting beyond what triggers are capable of"
Here are my two cents:
If it is a script, more can be done than highlighting, e.g. autocorrection.
A script would need to be given the currently printed line, do its formatting, and return the formatted line for display.
For stdout and stderr that happens once per line and the slowdown may well be worth the utility of processing the line beyond the capabilities of a trigger.
Highlighting (and more) while typing would require the script to run after every typed character, and that may become intolerably slow (depending on the script, of course). Typing too fast can already cause skipping highlighting trigger (see Caveat here).
Can a formatting script run asynchronously from typing, changing a typed character (autocorrect) or its formatting (highlighting) a more or less brief instant after it has been typed (i.e., when the user has already typed a few more characters)? But then a line might require some time after typing was finished to catch up with the processing. Would that not be very annoying or distracting to most users?
An alternative would be running a line through a script before and without yet running its command. This would require two keystrokes to run its command: type the line — hit one key to process it with a script — hit another key to run the line in shell. This would allow correcting the line, e.g. for a mistyped non-breaking space, if the first (script-firing) key can be used multiple times.
So, IMO, routing stdout and stderr through a script may be a worthwhile enhancement, while doing so for typed input may not be too useful.