Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,10 @@ private void skipOverFoldedParagraphs( ObservableValue<? extends Integer> ob, In
{
if ( getCell( newParagraph ).isFolded() )
{
// Prevent Ctrl+A and Ctrl+End breaking when the last paragraph is folded
// github.com/FXMisc/RichTextFX/pull/965#issuecomment-706268116
if ( newParagraph == getParagraphs().size() - 1 ) return;

int skip = (newParagraph - prevParagraph > 0) ? +1 : -1;
int p = newParagraph + skip;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public Paragraph<PS, SEG, S> getParagraph() {

public <T extends Node & Caret> double getCaretOffsetX(T caret) {
layout(); // ensure layout, is a no-op if not dirty
checkWithinParagraph(caret);
if ( isVisible() /* notFolded */ ) checkWithinParagraph(caret);
Bounds bounds = caret.getLayoutBounds();
return (bounds.getMinX() + bounds.getMaxX()) / 2;
}
Expand Down