Skip to content

Commit

Permalink
Merge pull request #700 from JordanMartinez/convertMultipleChangesInt…
Browse files Browse the repository at this point in the history
…oSingleChange

Move selected text should be one change
  • Loading branch information
JordanMartinez authored Mar 7, 2018
2 parents 66810ca + 72bba1f commit 07c475c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions richtextfx/src/main/java/org/fxmisc/richtext/EditActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,11 @@ default void moveSelectedText(int position) {
StyledDocument<PS, SEG, S> 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());
Expand Down

0 comments on commit 07c475c

Please sign in to comment.