jacobslusser / ScintillaNET

A Windows Forms control, wrapper, and bindings for the Scintilla text editor.
MIT License
967 stars 245 forks source link

.Lines[intIndex].Position always returns 0. - Latest version, not 3.6 release. #539

Open joeduf opened 1 year ago

joeduf commented 1 year ago

In a slightly modified copy of the Scintilla.NET DEMO master app...

Just under the form constructor...

ScintillaNET.Scintilla TextArea; // just like the original demo

Inside the MainForm_Load(...

TextArea = new ScintillaNET.Scintilla(); // also just like the original demo

TextArea.UpdateUI += (this.UpdateUICustomGUIDColorizer); // added so I can customize GUID (not UUID) colorization

Inside my private void UpdateUICustomGUIDColorizer(object sender, UpdateUIEventArgs e)...

int startPos = TextArea.Lines[TextArea.FirstVisibleLine].Position;

startPos is ALWAYS 0 (zero) even though TextArea.FirstVisibleLine is correct... it does not matter how you move / scroll / position the cursor the .Position property never accurately reflects the document character index

Putting this In other words, if I extract any Line object from the Lines collection and try to fetch the position of that Line object I ways get zero regardless of whether it is Line 0, Line 1, Line 73, etc.

I'm trying to fetch just the text visible on the screen editor text area for a quick custom colorization with StartStyling / SetStyling