Skip to content

Commit 72bba1f

Browse files
Move selected text should be one change
1 parent 66810ca commit 72bba1f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

richtextfx/src/main/java/org/fxmisc/richtext/EditActions.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,11 @@ default void moveSelectedText(int position) {
190190
StyledDocument<PS, SEG, S> text = this.subDocument(sel.getStart(), sel.getEnd());
191191
if(position > sel.getEnd())
192192
position -= sel.getLength();
193-
deleteText(sel);
194-
insert(position, text);
193+
194+
createMultiChange(2)
195+
.deleteText(sel)
196+
.insertAbsolutely(position, text)
197+
.commit();
195198

196199
// select moved text
197200
selectRange(position, position + text.length());

0 commit comments

Comments
 (0)