[WebODF] Different behaviour on delete and backspace for emptied spans?

Friedrich W. H. Kossebau friedrich at kogmbh.com
Wed Jun 26 15:56:55 CEST 2013


Hi,

when testing if there will be any regressions on always normalizing* the 
position and length in OpRemoveText I found that there is different behaviour 
if in the following structure the char is removed by a backspace or a delete:

	<text:p><text:span>A</text:span></text:p>

Currently these are the results:

... on a backspace from behind the "A"

	<text:p><c:cursor/><text:span></text:span></text:p>

(ignore the cursor position, different topic, handled in separate email)

... on a delete from before the "A"

	<text:p><c:cursor/></text:p>

I would have expected to get the same results in both cases.

Playing with LO I found that there the span is kept in both cases (tested by 
creating an empty document, inserting an "A", marking it and directly 
formatting it to bold, removing the A in either ways again and saving as .fodt 
and inspecting with a text editor, while also seeing that with the empty 
document the Bold is toggled and any inserted chars are ending up in the span, 
being formatted with Bold).


* normalizing by doing this inside the execute method and restoring original 
values afterwards:
    if (length < 0) {
        position = position + length;
        length = -length;
    }

What do you think? Should emptied spans be deleted in this case? Or should 
empty spans only be deleted once a deletion range crosses their border?

Cheers
Friedrich
-- 
Friedrich W. H. Kossebau // KO GmbH
http://kogmbh.com/legal/


More information about the WebODF mailing list