tida1 / gwt-selection

Automatically exported from code.google.com/p/gwt-selection
0 stars 0 forks source link

Cursor position wrong on some nodes with Internet Explorer 9 #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. try the SelectionTest with Internet Explorer 9 (I'm using development mode)
2. click on the text area and try to position the cursor to q|uick or b|rown or 
e|r or t|h
3. look at the bottom right panel

What is the expected output? What do you see instead?
Expected output:
q|uick, b|rown, e|r, t|h

Actual output with IE9:
qui|ck, bro|wn, er |, |e la

In general, the computation of the cursor position seems to be wrong whenever 
the node has attributes. I didn't do extended test and I don't know if this 
makes sense at all, but at a first look it seems like that the cursor 
computation code is not counting the double quotes surrounding attribute values 
correctly.

What version of the product are you using? On what operating system?
Selection 1.1 under Windows 7 64-bit, IE9 (both 32-bit and 64-bit)

Please provide any additional information below.
With nodes without attributes (like fox jumped, ov, e la, zy dogs, Some 
spaces...) it works correctly.

Original issue reported on code.google.com by mauro...@tiscali.it on 11 Nov 2011 at 6:55

GoogleCodeExporter commented 8 years ago
No, it's not a problem of double quotes.
If you write in box bottom left box:
<span>ciao</span>
and then move the cursor in the text area, these are the results:
|ciao => |ciao
c|iao => cia|o
ci|ao => ciao|
cia|o => ciao|
ciao| => ciao|

Original comment by mauro...@tiscali.it on 11 Nov 2011 at 7:06

GoogleCodeExporter commented 8 years ago
However, if you specify text/offset position and hit >Cursor, the cursor is 
positioned correctly within the text area:
0, 0 => |ciao
0, 1 => c|iao
0, 2 => ci|ao
0, 3 => cia|o
0, 4 => ciao|
0, 5 => ciao|

Original comment by mauro...@tiscali.it on 11 Nov 2011 at 7:09

GoogleCodeExporter commented 8 years ago
Hi, can you give some solution to this problem?
I really need it...
Thank you!

Original comment by fenyvesi...@gmail.com on 8 Jan 2012 at 2:04

GoogleCodeExporter commented 8 years ago
Hmm I don't have access to IE9 handy right now, I'll have to see if I can find 
a machine to try this on..

Original comment by koz...@gmail.com on 11 Jan 2012 at 12:17

GoogleCodeExporter commented 8 years ago
Looks like IE9 was processing the testElement (a div) and including it in the 
text which added a \r\n to the range, hence the two characters shift.
All what is needed is to remove the 'div' before manipulating the range.
I've attached a patch.

Original comment by mma...@gmail.com on 19 Jan 2012 at 11:02

Attachments: