RFR: 8366201: RichTextArea: remove allowUndo parameter [v3]

Andy Goryachev angorya at openjdk.org
Wed Oct 29 21:54:17 UTC 2025


> Original user feedback (see https://mail.openjdk.org/pipermail/openjfx-discuss/2025-August/000267.html ) called for adding an `allowUndo` parameter to `applyStyle()` and `setStyle()` methods similarly to `replaceText()`.
> 
> Upon further analysis, the `allowUndo` parameter was a mistake: allowing the application code to disable creating undo/redo entries messes up the internal undo/redo stack.
> There is an internal need (`UndoableChange`), but it should not be exposed via public API.
> 
> This PR also adds `isUndoRedoEnabled()` and `setUndoRedoEnabled()` to the `StyledTextModel`, as well as its forwarding aliases to `RichTextArea` to allow for the application to disable undo/redo temporarily, for example, when building a document from multiple segments.
> 
> WARNING this is an incompatible change, permitted because of the incubator.
> 
> There remains a possible issue with currently unlimited size of the undo/redo stack - perhaps we should limit its depth to maybe 100-200 entries, see https://bugs.openjdk.org/browse/JDK-8370447 .

Andy Goryachev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:

 - review comments
 - Merge remote-tracking branch 'origin/master' into 8366201.allow.undo
 - undo redo enabled logic
 - cleanup
 - cleanup
 - removed allow undo parameter
 - nl
 - test
 - append insert text
 - tests
 - ... and 1 more: https://git.openjdk.org/jfx/compare/48b57b54...ffe6894c

-------------

Changes:
  - all: https://git.openjdk.org/jfx/pull/1941/files
  - new: https://git.openjdk.org/jfx/pull/1941/files/84d02951..ffe6894c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=1941&range=02
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1941&range=01-02

  Stats: 381 lines in 14 files changed: 215 ins; 33 del; 133 mod
  Patch: https://git.openjdk.org/jfx/pull/1941.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1941/head:pull/1941

PR: https://git.openjdk.org/jfx/pull/1941


More information about the openjfx-dev mailing list