xorc1zt wrote:
from scite
Code:
void SciTEBase::HighlightCurrentWord(bool highlight) {
if (!currentWordHighlight.isEnabled)
return;
GUI::ScintillaWindow &wCurrent = wOutput.HasFocus() ? wOutput : wEditor;
wCurrent.Call(SCI_SETINDICATORCURRENT, indicatorHightlightCurrentWord);
int lenDoc = wCurrent.Call(SCI_GETLENGTH);
wCurrent.Call(SCI_INDICATORCLEARRANGE, 0, lenDoc);
if (!highlight)
return;
int selStart = wCurrent.Call(SCI_GETSELECTIONSTART);
int selEnd = wCurrent.Call(SCI_GETSELECTIONEND);
bool noUserSelection = selStart == selEnd;
SString wordToFind = RangeExtendAndGrab(wCurrent, selStart, selEnd,
&SciTEBase::islexerwordcharforsel);
if (wordToFind.length() == 0 || wordToFind.contains('\n') || wordToFind.contains('\r'))
return; if (noUserSelection && currentWordHighlight.statesOfDelay == currentWordHighlight.noDelay) {
currentWordHighlight.statesOfDelay = currentWordHighlight.delay;
currentWordHighlight.elapsedTimes.Duration(true);
return;
}
int selectedStyle = wCurrent.Call(SCI_GETSTYLEAT, selStart);
wordToFind = EncodeString(wordToFind);
wCurrent.Call(SCI_SETSEARCHFLAGS, SCFIND_MATCHCASE | SCFIND_WHOLEWORD);
wCurrent.Call(SCI_SETTARGETSTART, 0);
wCurrent.Call(SCI_SETTARGETEND, lenDoc);
int indexOf = wCurrent.CallString(SCI_SEARCHINTARGET,
wordToFind.length(), wordToFind.c_str());
while (indexOf != -1 && indexOf < lenDoc) {
if (!currentWordHighlight.isOnlyWithSameStyle || selectedStyle ==
wCurrent.Call(SCI_GETSTYLEAT, indexOf)) {
wCurrent.Call(SCI_INDICATORFILLRANGE, indexOf, wordToFind.length());
}
wCurrent.Call(SCI_SETTARGETSTART, indexOf + wordToFind.length() + 1);
wCurrent.Call(SCI_SETTARGETEND, lenDoc);
indexOf = wCurrent.CallString(SCI_SEARCHINTARGET, wordToFind.length(),
wordToFind.c_str());
}
}
I found how to activate this. You must edit the SciTEGlobal.properties file, and uncoment (remove the # character) from the line that has the setting:
change:
#highlight.current.word=1
to:
highlight.current.word=1
So apparently Scite's biggest drawback is the lack of dialog boxes for changing properties. You also have to edit properties files to save the "recent file" list, and a whole bunch of other features people would expect. I haven't figure out how to get the PB syntax to work, though, even adding it to the list and all the other stuff that would seem necessary.