WPF Syntax Editor:

SyntaxEditor for WPF Forum

Posted 6 months ago by ks techno
Version: 22.1.1
Avatar

Hi,

When double clicking on a word in the sytax editor, it will highlight the entire word. Which is alright.
But let's say I have a % symbol in the word, is there an option for me to set this as a rule; consider the % sign as part of the word and highlight both before and after the % sign?

For example, when double clicking on the 'I_WANT_TO_HIGHLIGHT_THIS' text, I want the % sign and 'AND_THAT' text to be highlight as a whole too.

"I_WANT_TO_HIGHLIGHT_THIS%AND_THAT"

Comments (2)

Answer - Posted 6 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You can create a custom IWorkBreakFinder language service to implement this.  Here's the documentation on word break finders.

In you scenario, this code would add % as a word character:

var finder = new DefaultWordBreakFinder();
finder.WordContainsAdditionalCharacters.Add('%');
language.RegisterWordBreakFinder(finder);


Actipro Software Support

Posted 6 months ago by ks techno
Avatar

Works perfectly, thank you.

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.