StyledTextCtrl bugs in 2.9

Hi all,

I am having problems with StyledTextCtrl widget in 2.9.2.4.

1) I am unable to write any of 'ů' or ' " ' characters using Czech
QWERTY keyboard (it is the same key, " is with Shift). It worked fine
in 2.8.x. The characters can be inserted without the problem, but the
widget somehow ignores the key pressed.

2) When using GotoPos, SetTargetStart, SetTargetEnd, StartStyling,
SetStyling etc. on unicode text, the position is in bytes, not in
characters. Strangely enough PositionFromPoint returns it in
characters. This makes it very difficult to use as the widget uses
UTF-8 with variable byte length of characters. It has been there for a
long time. I have found some references to the old bug (
http://trac.wxwidgets.org/ticket/1300 ) which I hoped would be fixed
in newer versions of Scintilla / wxWidgets / wxPython. I have some
effective but not very efficient workaround so I do not care about
this bug as much.

I would be interested in any comments, workarounds or explanations
concerning those.

Thanks a lot

testsct.py (789 Bytes)

···

--
Fenikso

Hi all,

I am having problems with StyledTextCtrl widget in 2.9.2.4.

1) I am unable to write any of 'ů' or ' " ' characters using Czech
QWERTY keyboard (it is the same key, " is with Shift). It worked fine
in 2.8.x. The characters can be inserted without the problem, but the
widget somehow ignores the key pressed.

I think there is already a ticket on this. You may want to search for it and add your comments and info about your test case.

2) When using GotoPos, SetTargetStart, SetTargetEnd, StartStyling,
SetStyling etc. on unicode text, the position is in bytes, not in
characters. Strangely enough PositionFromPoint returns it in
characters. This makes it very difficult to use as the widget uses
UTF-8 with variable byte length of characters. It has been there for a
long time. I have found some references to the old bug (
wxTrac has been migrated to GitHub Issues - wxWidgets ) which I hoped would be fixed
in newer versions of Scintilla / wxWidgets / wxPython. I have some
effective but not very efficient workaround so I do not care about
this bug as much.

The problem is that Scintilla uses utf-8 in its in-memory buffers for the document, and so we are kinda stuck with how it counts positions and etc. I've often thought that it would be nice if it used wchar_t buffers instead of char buffers, then it could use unicode data internally and its positions would align with the character positions in Python Unicode objects. I don't have anywhere near enough time to work on that however, but I would advocate for the change with Neil if somebody else wanted to work on a patch.

···

On 9/23/11 4:15 AM, Fenikso wrote:

--
Robin Dunn
Software Craftsman