On Tue, 26 Jan 2010 21:26:11 +0200
"Ville M. Vainio" <[email protected]> wrote:

> > e) we need a trivial PyQt QTextEdit app to test in, but I'm hungry :-)  
> 
> stickynotes should be pretty trivial :-)

Oh yes, doh, stickynotes is a very plain QTextEdit.  And it can edit the text 
correctly (both Edwards compact example and the longer example I gave 
originally.  Hmm, but I guess it's not a matter of can QTextEdit delete a range 
from text containing mixed length UTF chars, but does it report the select 
indexes correctly.

One way to sidestep the problem might be to call Qt's removeSelectedText() in 
Leo's deleteTextSelection... nah, that doesn't really help.

Here's some code to help analyze:

---8K-----
import sys
from PyQt4 import Qt

app = Qt.QApplication(sys.argv) 

w = Qt.QTextEdit()

w.show()

def showselect():
    text = w.toPlainText()
    c = w.textCursor()
    print(c.position(), c.selectionStart(),
        c.selectionEnd(), text[c.position()])

app.connect(w, Qt.SIGNAL("selectionChanged()"), showselect)

app.exec_()
---8K-----

In Edward's Example 2. the first character is a *combined* character, U+0935 
DEVANAGARI LETTER VA, combined with U+093E DEVANAGARI VOWEL SIGN AA.

Here are the two characters on separate lines:

व
ा

if you delete the carriage return separating them they fuse.  Starting from the 
left of the fused character and pressing delete, they're both deleted together. 
 Starting from the right and pressing backspace, first the vowel parts deleted, 
then the other part.  Cursor keys however regard them as a single entity.

All very interesting but not really helping with the bug.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to