Fix text insertion at page breaks and add Page Break marker#119
Merged
Conversation
When the user typed inside a PageBreakWhiteSpaceElement, the new element was always inserted one line below the previous text no matter where the cursor was. This happened because the blank page region is a single map-list entry, so the index-difference formula always returned 1. Changed to Store the cursor widget offset at message receipt, then overrode blankLinesBefore with the line distance from the end of the previous text element (curElement.getEnd()) to the cursor. Using curElement.getEnd() as the baseline rather than wse.getStart() When I did it the other way the offset was off by one amd the line inserted actually moved up a line while the cursor went to the correct place.
Added a "Page Break" label in the style pane (StylePane.kt) at the line corresponding to the end of each PageBreakWhiteSpaceElement region. This places the marker on the last blank line before the next page begins, making it visible in the style view alongside existing style labels.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes it easy to add text before page breaks and it works more like a normal word processor. I also went back after fixing this and added the page break in the style view because it was in the issue.