kogmbh/WebODF — pull request #171 by peitschie (2013-11-04 06:01:08+00:00)
Title: Correct various issues with insertion and selection of whitespace elements

Issue 1 - Every second whitespace element is incorrectly downgraded to a literal space character
Reproduction steps
1) Open http://www.webodf.org/demo/ci/webodf-0.4.2-1305-g54e8ab4/editor/localeditor.html
2) Select after the first space in the document ("WebODF ")
3) Add 3 spaces
4) Inspect the resulting DOM tree, and note that only 2 space elements are present. This *should* be three, as it is one contiguous block of space characters

Issue 2 - Inserting a string ending in with a whitespace character at the end of paragraph doesn't upgrade the trailing whitespace
See failing unit tests. Inserting a single standalone space using space bar is ok, but pasting some text ending with a space character at the end of a paragraph results in the space being discarded.
1) in Chrome, open http://www.webodf.org/demo/ci/webodf-0.4.2-1305-g54e8ab4/editor/localeditor.html (FF doesn't support paste)
2) Select from the beginning of the first word until after the first space in the document ("WebODF ")
3) Move the cursor to the end of the first paragraph, and paste the copied text. Observe that the trailing space is discarded.
(Note: it may still be desirable to "trim" trailing spaces on inserted segments, but this should be a conscious decision done by the paste handler, rather than an accident due to the insert text implementation)

Issue 3 - Whitespace elements can't be selected
1) Open http://www.webodf.org/demo/ci/webodf-0.4.2-1305-g54e8ab4/editor/localeditor.html
2) Select after the first space in the document ("WebODF ")
3) Add 3 spaces
4) Reset the cursor to just after "WebODF"
5) Hold shift and extend the selection to the right 1 at a time. Note every second space results in a strange gap appearing between the virtual selection overlay and the blinking caret.