Disable highight when no selection
Not really an issue I suppose, but I cannot find where to set this option:
When I click a word, it and all other occurrences are highlighted. I do not want that when I just click the word, I only want it when I select the word (like in Notepad++). What setting to use to control that behavior?
? It doesn't do that by default. Where do you execute the code to highlight the "word"?
I don't, it is the default behaviour in the ScintillaNet.WPF project I am basing my solution on, but I cannot seem to find which setting to change.
** Update:**
I decided to look more. In DocumentForm.xaml.cs, you can comment out the code in Scintilla_MouseDown():
private void Scintilla_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
//{
// switch (e.Button)
// {
// case System.Windows.Forms.MouseButtons.Left:
// if (FindReplace == null) break;
// //Clear current highlights
// FindReplace.ClearAllHighlights();
// //Highlight identical text
// string sWord = Scintilla.GetWordFromPosition(Scintilla.CurrentPosition);
// if (!string.IsNullOrEmpty(sWord))
// FindReplace.FindAll(sWord, false, true);
// break;
// default:
// break;
// }
//}
}
Thank youI Wouln't have thought of looking into the integration with FindReplace stuff. This puts me on the right track, issue can be closed. Note that I was actually wrong to put the issue here, as it really was with FindReplace.
I added it to my ScintillaNet Winform project. Eventually, I'll post the whole Editor class, which has comment/uncomment, custom csyntax highlighter, keyword loading from JSON file, auto indent, printing, etc ... I've got to enhance everything, add default params, add document management. We'll see what else.
private bool HighlightWords; //Just define anywhere in your class
Click += (s, e) =>
{
if (HighlightWords) { findReplace.ClearAllHighlights(); HighlightWords = false; }
findReplace.ClearAllHighlights();
};
DoubleClick += (s, e) =>
{
string sWord = GetWordFromPosition(CurrentPosition);
if (sWord != "") { findReplace.FindAll(sWord, false, true); HighlightWords = true; }
};