Skip to content

Commit e404747

Browse files
authored
Update UndoUtils.java
1 parent 6d227a8 commit e404747

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,12 @@ public static <PS, SEG, S> Consumer<List<RichTextChange<PS, SEG, S>>> applyMulti
268268
* Address #912 "After undo/redo, new text is inserted at the end".
269269
* Without breaking PositionTests. (org.fxmisc.richtext.api.caret)
270270
*/
271-
private static void moveToChange( GenericStyledArea area, TextChange chg ) {
272-
int pos = chg.getPosition(), len = chg.getNetLength();
273-
if ( len > 0 ) {
274-
pos = Math.min( pos + Math.abs(len), area.getLength() );
275-
}
276-
area.moveTo( pos );
271+
private static void moveToChange( GenericStyledArea area, TextChange chg )
272+
{
273+
int pos = chg.getPosition();
274+
int len = chg.getNetLength();
275+
if ( len > 0 ) pos += len;
276+
277+
area.moveTo( Math.min( pos, area.getLength() ) );
277278
}
278279
}

0 commit comments

Comments
 (0)