I am currently writing a lexer for the AutoHotkey language - which is
very hard to highlight correctly!
When testing, I often wonder which style a text segment actually got.
Some styles may be hard to distinguish, on purpose or not.
Of course, for debugging, you can just use bozo colors, with background
and al. But this may not be so convenient.
Then, I recalled Neil introduced some time ago an interesting feature
that was test-implemented in SciTE, ie. it is functionnal, but useless
in its current state. I mean, the dwell functionnality.
It is activated by the dwell.period property: uncomment it, and after 1
second (1000ms) of mouse standing still over a word, a tooltip will
display this word.
I thought it would be cool to use this feature to get the current style.
It is actually very simple:
(SciTEBase.cxx)
case SCN_DWELLSTART: {
if (INVALID_POSITION == notification->position) {
char message[200];
sprintf(message, "%0d (%0d,%0d)", notification->position,
notification->x, notification->y);
} else {
//~ int endWord = notification->position;
//~ SString message =
//~ RangeExtendAndGrab(wEditor,
//~ notification->position, endWord,
//~ iswordcharforsel);
SString message(SendEditor(SCI_GETSTYLEAT,
notification->position));
if (message.length()) {
SendEditorString(SCI_CALLTIPSHOW,
notification->position, message.c_str());
}
}
}
break;
I don't know if Neil will be interested enough to officialise this
change (or a variant) but lexer writers are able to apply this change
themselves.
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest