This project is read-only.


Topics: Developer Forum, Project Management Forum, User Forum
Dec 8, 2009 at 3:58 AM

private void Form2_Load(object sender, EventArgs e)

for example:
scintilla1.text = "abc中文";
The cursor at last。
now : scintilla1.Text.Length =5  but currentPos = 9
please help me!!!

Dec 8, 2009 at 4:00 AM

the scintillaNet is

Dec 8, 2009 at 10:24 AM


I had the same problem, what exactly do you want t do?

The reason why currentPos is 9, is that scintilla returns the byte count with its currentPosition not the real word count.

You could use the Method


to get the word of your position.

Best Regards

Dec 8, 2009 at 10:46 AM

 Klingel , Thank you very much !

Dec 8, 2009 at 8:47 PM

Klingel is correct. When talking about positions and lengths Scintilla usually means bytes, not characters. Scintilla's Unicode handling is always UTF-8 which means that ASII ranged characters take 1 byte and extended characters are 2-4 bytes. Scintilla.Text.Length will return character length because the Scintilla.Text is a .NET UTF-16 string, .Length always returns the number of characters. If you want to get the length in bytes use Scintilla.TextLength.