Comments (6)
I agree this is a bit unusual. I opened a ticket with the native Scintilla team. You can follow the progress here: https://sourceforge.net/p/scintilla/bugs/1736/.
from scintillanet.
Thanks. It's strange that Notepad++ doesn't have the same problem...
from scintillanet.
I don't know why this didn't occur to me earlier, but your comment about Notepad++ caused me to realize I was answering the question you asked, but not the question you meant to ask. You're assuming Notepad++ doesn't have this problem and I would guess that you came to that conclusion because you've used the Find dialog in Notepad++ to highlight a word or words like your application does and don't see the same behavior. You may not know, however, that when Notepad++ highlights a word it isn't using Styles to do that, it's using Indicators. If the goal of your program is to highlight regex matches it should also be using Indicators to do that.
A brief explanation of Indicators can be found in the wiki article Find and Highlight Words but I threw together a quick sample for you below as well.
scintilla.Text = "\"The quick brown fox jumps over a lazy dog\" is an English-language pangram—a phrase that contains all of the letters of the alphabet. It is commonly used for touch-typing practice. It is also used to test typewriters and computer keyboards, show fonts, and other applications involving all of the letters in the English alphabet. Owing to its brevity and coherence, it has become widely known.\r\n";
scintilla.WrapMode = WrapMode.Word;
scintilla.Indicators[8].Under = true;
scintilla.Indicators[8].Style = IndicatorStyle.StraightBox;
scintilla.Indicators[8].ForeColor = Color.LightGreen;
scintilla.Indicators[8].OutlineAlpha = 255;
scintilla.Indicators[8].Alpha = 255;
scintilla.IndicatorCurrent = 8;
foreach (var line in scintilla.Lines)
{
var text = line.Text;
var pos = line.Position;
foreach (Match match in Regex.Matches(text, @"known\.\r\n"))
scintilla.IndicatorFillRange(pos + match.Index, match.Length);
}
Using this approach there is no issue with wrapped lines.
from scintillanet.
Great. I've converted the program to use indicators instead. I don't think it's faster now, though it fixes the reason behind this thread.
I initially tried indicators days ago, though missed the useful Under
property which means the highlighting isn't partially obscuring the text it's trying to highlight. Perhaps you could put scintilla.Indicators[NUM].Under = true;
into the example at: https://github.com/jacobslusser/ScintillaNET/wiki/Find-and-Highlight-Words
Thanks again for the help!
from scintillanet.
BTW, the native Scintilla team responded to my bug ticket by essentially saying, "yes this is probably not the desired behavior, but the priority on fixing it is low".
Since you got Indicators working, and I think they're a better solution, and the native Scintilla team doesn't seem in a hurry to fix this, I'm going to close this issue.
from scintillanet.
Thanks. Let me know if they ever fix it. One advantage over Indicators is that a small bit at the start of new lines are highlighted, which is nice if you're trying to search for newlines. No hurry though.
from scintillanet.
Related Issues (20)
- Changing EOL type crashes Scintilla HOT 4
- Help!!! How to setting color of default text HOT 2
- Avalonia UI support HOT 1
- Help! Cannot find a mask that works for RgbaImage marker symvol HOT 1
- How do i remove this corner? HOT 1
- How does line indentation work? HOT 1
- Question Regarding Combined Characters and Regex
- Failed to create component 'Scintilla' HOT 4
- sign project
- How can I remove the background color of the focused line? HOT 2
- Is there any way to highlight BETWEEN characters?
- Scrollbar don't work
- Scintilla Control causes caret in other controls to jump/bug HOT 1
- STOP drag drop on windows
- Lexer.Html does not support code folding
- Error on HEREDOC php HOT 3
- Cant drag ScintillaNET control into the form.
- Undo and Redo HOT 1
- .Lines[intIndex].Position always returns 0. - Latest version, not 3.6 release.
- Find in files feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scintillanet.