Unfortunatly that explanations don't help much.
jacobslusser wrote:
Especially annoying is the fact that if I type in a space (which triggers the TextChanged Event in any case) it only doesn't work on the first space after a letter - after that it does work, so this can only be a bug.
jacobslusser wrote:
I also looked through the posted link and found this workaround (posted by you). But unfortunatly it is also not reliable. Same problem as above, but here for all kind of chars. The first (and only the first) entered char after a letter doesn't change the reverse engineered Position. The method also bugs for inserted Text via CnP.
So, what to do? Such a simple thing should be possible somehow, right?
2mQ
jacobslusser wrote:
Everything you are describing can easily be explained....I wasn't specific on the event because it shouldn't matter. As long as the event reacts in an approproite way (namely after the TextChange happened), the CurrentPos should be correct. But to specify this, I used both the TextChanged and the SelectionChanged Event as well as the suggested NativeScintilla.UpdateUI Event. Both the TextChanged and SelectionChanged Events do get fired.
What event are you using to trigger the update of your cursor position text box? You weren't specific... but you would definitely need to be using one. The CurrentPos and/or Caret.Position properties aren't going to notify you of changes, and as a result, the value displayed there could be stale.
Especially annoying is the fact that if I type in a space (which triggers the TextChanged Event in any case) it only doesn't work on the first space after a letter - after that it does work, so this can only be a bug.
jacobslusser wrote:
As for the position value being off when you use Unicode characters such as ü', 'ä' or 'ö'... that is because those properties tell you the current byte offset, not the character offset. As you may know Unicode characters can often require more than one byte of storage. This problem is a limitation of the native Scintilla component and has been well documented in these forums. https://www.google.com/#q=Unicode+site%3Ahttp%3A%2F%2Fscintillanet.codeplex.com%2Fdiscussions%2FThe GetColumn method doesn't do what I am looking for, as it gets reset after every new line. But I need the absolute position of the caret in the text.
At this point, hopefully the bells are starting to go off and I won't need to explain why your code sample could throw an exception.
Jacob
I also looked through the posted link and found this workaround (posted by you). But unfortunatly it is also not reliable. Same problem as above, but here for all kind of chars. The first (and only the first) entered char after a letter doesn't change the reverse engineered Position. The method also bugs for inserted Text via CnP.
So, what to do? Such a simple thing should be possible somehow, right?
2mQ