PavelTorgashov / FastColoredTextBox

Fast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
Other
1.21k stars 463 forks source link

How to change the tooltip pattern? #170

Closed nongcaro closed 4 years ago

nongcaro commented 5 years ago

Tooltip only shows hovered words. I want to change it to a custom pattern. How do I go about doing this?

PavelTorgashov commented 4 years ago

Tooltip is generated in method OnToolTip. There is hard-coded pattern for tooltip: string hoveredWord = r.GetFragment("[a-zA-Z]").Text; You can make separate property that will contain pattern and use it.

nongcaro commented 4 years ago

@PavelTorgashov Am I supposed to override OnToolTip?

nongcaro commented 4 years ago

My Regex is not working, but it's working in Regex101, what's the case with this? For an example, \=[0-9]* doesn't work, but just [0-9] works.

PavelTorgashov commented 4 years ago

@nongcaro Fragment regex is expression for one char only. Therefore modificators like * - do not work in this case.

nongcaro commented 4 years ago

@PavelTorgashov I want to match complete expressions, is it possible? For an example, I want to match everything between [] if the cursor is hovered inside it?

nongcaro commented 4 years ago

Never mind it, made my own function.