Skip to content

Fix text insertion at page breaks and add Page Break marker#119

Merged
krperry merged 2 commits into
mainfrom
insert_before_break
May 22, 2026
Merged

Fix text insertion at page breaks and add Page Break marker#119
krperry merged 2 commits into
mainfrom
insert_before_break

Conversation

@krperry
Copy link
Copy Markdown
Collaborator

@krperry krperry commented May 22, 2026

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.

krperry added 2 commits May 22, 2026 10:10
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.
@krperry krperry merged commit 56140f5 into main May 22, 2026
1 check passed
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.

1 participant