Hi, recently noticed strange bug trying to automatically adjust typing position.
When TextCtrl have style TE_MULTILINE GetSelection counts each line twice, resulting in wrong positions. For example if TextCtrl contains 3 newline symbols GetSelection returns (0,6) instead of (0,3). Really anoying to count them out…
I have attached a sample demonstrating this.
P.S. Using python 2.7 with wxwidgets 2.8… on win7 x64
Hi,
I believe, the different newline representation might cause this behaviour,
the wx docs mention the following:
http://docs.wxwidgets.org/2.8/wx_wxtextctrl.html#wxtextctrlgetselection
"Please note that the indices returned may be used with the other
wxTextctrl methods but don't necessarily represent the correct indices
into the string returned by GetValue() for multiline controls under
Windows (at least,) you should use GetStringSelection() to get the
selected text."
http://docs.wxwidgets.org/2.8/wx_wxtextctrl.html#wxtextctrlgetvalue
"Gets the contents of the control. Notice that for a multiline text
control, the lines will be separated by (Unix-style) \n characters,
even under Windows where they are separated by a \r\n sequence in the
native control."
When TextCtrl have style TE_MULTILINE GetSelection counts each line twice,
resulting in wrong positions. For example if TextCtrl contains 3 newline
symbols GetSelection returns (0,6) instead of (0,3). Really anoying to count
them out...
I have attached a sample demonstrating this.
P.S. Using python 2.7 with wxwidgets 2.8... on win7 x64
Thank You. But that sucks, I need to correct positions and I need to be able to alter them across various lines.
···
On Wednesday, August 1, 2012 12:55:57 PM UTC+3, jj wrote:
Hi, recently noticed strange bug trying to automatically adjust typing position.
When TextCtrl have style TE_MULTILINE GetSelection counts each line twice, resulting in wrong positions. For example if TextCtrl contains 3 newline symbols GetSelection returns (0,6) instead of (0,3). Really anoying to count them out…
I have attached a sample demonstrating this.
P.S. Using python 2.7 with wxwidgets 2.8… on win7 x64