@@ -82,8 +82,8 @@ public static <PS, SEG, S> UndoManager<List<RichTextChange<PS, SEG, S>>> richTex
8282 GenericStyledArea <PS , SEG , S > area , UndoManagerFactory factory , Duration preventMergeDelay ) {
8383 return factory .createMultiChangeUM (area .multiRichChanges (),
8484 TextChange ::invert ,
85- undoMultiRichTextChange (area ),
86- redoMultiRichTextChange (area ),
85+ applyMultiRichTextChange (area ),
86+ applyMultiRichTextChange (area ),
8787 TextChange ::mergeWith ,
8888 TextChange ::isIdentity ,
8989 preventMergeDelay );
@@ -128,8 +128,8 @@ public static <PS, SEG, S> UndoManager<List<PlainTextChange>> plainTextUndoManag
128128 GenericStyledArea <PS , SEG , S > area , UndoManagerFactory factory , Duration preventMergeDelay ) {
129129 return factory .createMultiChangeUM (area .multiPlainChanges (),
130130 TextChange ::invert ,
131- undoMultiPlainTextChange (area ),
132- redoMultiPlainTextChange (area ),
131+ applyMultiPlainTextChange (area ),
132+ applyMultiPlainTextChange (area ),
133133 TextChange ::mergeWith ,
134134 TextChange ::isIdentity ,
135135 preventMergeDelay );
@@ -160,48 +160,26 @@ public static <PS, SEG, S> Consumer<RichTextChange<PS, SEG, S>> applyRichTextCha
160160 return change -> area .replace (change .getPosition (), change .getRemovalEnd (), change .getInserted ());
161161 }
162162
163- public static <PS , SEG , S > Consumer <List <PlainTextChange >> undoMultiPlainTextChange (
164- GenericStyledArea <PS , SEG , S > area ) {
165- return changeList -> {
166- MultiChangeBuilder <PS , SEG , S > builder = area .createMultiChange (changeList .size ());
167- for (PlainTextChange c : changeList ) {
168- builder .replaceText (c .getPosition (), c .getRemovalEnd (), c .getInserted ());
169- }
170- builder .commit ();
171- };
172- }
173-
174- public static <PS , SEG , S > Consumer <List <PlainTextChange >> redoMultiPlainTextChange (
175- GenericStyledArea <PS , SEG , S > area ) {
176- return changeList -> {
177- MultiChangeBuilder <PS , SEG , S > builder = area .createMultiChange (changeList .size ());
178- for (PlainTextChange c : changeList ) {
179- builder .replaceTextAbsolutely (c .getPosition (), c .getRemovalEnd (), c .getInserted ());
180- }
181- builder .commit ();
182- };
183- }
184-
185163 /**
186- * Undoes a list of {@link RichTextChange} to the given area when the {@link UndoManager}'s change stream emits an event
187- * by {@code area.replace (change.getPosition(), change.getRemovalEnd(), change.getInserted()}.
164+ * Applies a list of {@link PlainTextChange}s to the given area when the {@link UndoManager}'s change stream emits
165+ * an event by {@code area.replaceAbsolutely (change.getPosition(), change.getRemovalEnd(), change.getInserted()}.
188166 */
189- public static <PS , SEG , S > Consumer <List <RichTextChange < PS , SEG , S >>> undoMultiRichTextChange (
167+ public static <PS , SEG , S > Consumer <List <PlainTextChange >> applyMultiPlainTextChange (
190168 GenericStyledArea <PS , SEG , S > area ) {
191169 return changeList -> {
192170 MultiChangeBuilder <PS , SEG , S > builder = area .createMultiChange (changeList .size ());
193- for (RichTextChange < PS , SEG , S > c : changeList ) {
194- builder .replace (c .getPosition (), c .getRemovalEnd (), c .getInserted ());
171+ for (PlainTextChange c : changeList ) {
172+ builder .replaceTextAbsolutely (c .getPosition (), c .getRemovalEnd (), c .getInserted ());
195173 }
196174 builder .commit ();
197175 };
198176 }
199177
200178 /**
201- * Redoes a list of {@link RichTextChange} to the given area when the {@link UndoManager}'s change stream emits an event
202- * by {@code area.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted()}.
179+ * Applies a list of {@link RichTextChange} to the given area when the {@link UndoManager}'s change stream emits
180+ * an event by {@code area.replaceAbsolutely(change.getPosition(), change.getRemovalEnd(), change.getInserted()}.
203181 */
204- public static <PS , SEG , S > Consumer <List <RichTextChange <PS , SEG , S >>> redoMultiRichTextChange (
182+ public static <PS , SEG , S > Consumer <List <RichTextChange <PS , SEG , S >>> applyMultiRichTextChange (
205183 GenericStyledArea <PS , SEG , S > area ) {
206184 return changeList -> {
207185 MultiChangeBuilder <PS , SEG , S > builder = area .createMultiChange (changeList .size ());
0 commit comments