Problem with new encoding for Text

Topics: Developer Forum, User Forum
Oct 25, 2009 at 11:23 PM

Hello.

I am trying out the new changes commited and there seems to be a breaking change in the way text is passed to and from Scintilla in this new ScintillaNet. Using non-standart characters in the text like á, ç or ã seems to alter what you would expect from GetLineFromPosition. My guess is that scintilla is saving it and counting those characters as 2 positions when in reality there is only one. This breaks the folding parsing routine in an editor i am working on that relies that the position of the token output by the parser will match with positions in scintilla so that I can set the folding markers to the correct line.

In particular this is the code I use:

 

	line = scintilla.Lines.FromPosition(tokenStart);

	scintilla.Lines[line].IsFoldPoint = true;

In the new version the line returned is not coherent with the line calculated from the return of scintilla.Text. I checked and all characters in scintilla.Text are formated correctly so it must be the way scintilla is saving the string internally that causes the incorrect calculation of FromPosition(). I don't know this is an issue with scintillaNet ou scintilla but can anyone say if this should be added as an Issue to scintillaNet or help me find a workaround?

 

Meanwhile Ill have to keep using the older version where positions match correctly.

Coordinator
Oct 28, 2009 at 8:38 PM

You should be good if you switch your encoding back to a non-utf8 encoding as long as your non-ascii characters fit into 1 byte.