Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect line endings when wrapping occurs between elements #774

Merged
merged 3 commits into from Sep 10, 2014

Conversation

peitschie
Copy link
Contributor

Line ending detection was relying on wrapping occurring near or in a block of collapsed whitespace. When wrapping occurs between two elements, both previous and next rectangles may be defined, though the vertical overlap will be absent.

Line ending detection is still not stable when the wrap point doesn't span a cursor position (as happens when the wrap occurs over whitespace). Fixing this issue is not easy, so these tests demonstrate the current bad behaviour so at least it is somewhat documented.

Demonstrating line detection problem

  1. Download https://drive.google.com/file/d/0B1EH5OPb-RrjZWRwR2hnUnR6N2c/edit?usp=sharing
  2. Load it up in the editor (e.g., http://ci.kogmbh.com/deploy/WebODF/webodf-ci-b469-g8c98fcb7/wodotexteditor-ci-b469-g8c98fcb7/localeditor.html)
  3. Press the down cursor arrow. Note that the caret doesn't move at all, though the left & right arrows do move left and right.

@kogmbh-ci
Copy link

Build succeeded.
Refer to this link for build results: http://ci.kogmbh.com/jenkins/job/WebODF-PullReq/2088/

@kogmbh-ci
Copy link

Build succeeded.
Refer to this link for build results: http://ci.kogmbh.com/jenkins/job/WebODF-PullReq/2089/

@@ -549,6 +549,37 @@ gui.SelectionControllerTests = function SelectionControllerTests(runner) {
t.newPosition = getCursorPosition().position;
r.shouldBe(t, "t.newPosition", "3");
}
function testCountStepsToLineBoundary_Forward_NonTextWrapPoint() {
// spans actually display as blocks to force the browser to put each text block on it's own line
createOdtDocument("<text:p>ABC<text:span display='block'>DEF</text:span></text:p>");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the display='block' attribute a thing? Should this not be CSS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The answer lies waiting at line 798 in this file ⤵️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah of course. Sneaky :P

@kogmbh-ci
Copy link

Build succeeded.
Refer to this link for build results: http://ci.kogmbh.com/jenkins/job/WebODF-PullReq/2142/

@adityab
Copy link
Member

adityab commented Sep 10, 2014

This is a working nice fix. Please rebase and ship it!

Line ending detection was relying on wrapping occurring near or in a block
of collapsed whitespace. When wrapping occurs between two elements, both
previous and next rectangles may be defined, though the vertical overlap
will be absent.
Line ending detection is still not stable when the wrap point doesn't
span a cursor position (as happens when the wrap occurs over
whitespace). Fixing this issue is not easy, so these tests demonstrate
the current bad behaviour so at least it is somewhat documented.
@kogmbh-ci
Copy link

Build succeeded.
Refer to this link for build results: http://ci.kogmbh.com/jenkins/job/WebODF-PullReq/2185/

@peitschie
Copy link
Contributor Author

Thanks for reviewing this!

peitschie added a commit that referenced this pull request Sep 10, 2014
Detect line endings when wrapping occurs between elements
@peitschie peitschie merged commit e93ca35 into webodf:master Sep 10, 2014
@peitschie peitschie deleted the line-scan-fix branch September 10, 2014 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants