From 72bba1fc06bb21fd4a5e92ac59787df687067f5d Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Tue, 6 Mar 2018 16:01:20 -0800 Subject: [PATCH] Move selected text should be one change --- .../src/main/java/org/fxmisc/richtext/EditActions.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/richtextfx/src/main/java/org/fxmisc/richtext/EditActions.java b/richtextfx/src/main/java/org/fxmisc/richtext/EditActions.java index 856236d45..aef511535 100644 --- a/richtextfx/src/main/java/org/fxmisc/richtext/EditActions.java +++ b/richtextfx/src/main/java/org/fxmisc/richtext/EditActions.java @@ -190,8 +190,11 @@ default void moveSelectedText(int position) { StyledDocument text = this.subDocument(sel.getStart(), sel.getEnd()); if(position > sel.getEnd()) position -= sel.getLength(); - deleteText(sel); - insert(position, text); + + createMultiChange(2) + .deleteText(sel) + .insertAbsolutely(position, text) + .commit(); // select moved text selectRange(position, position + text.length());