Skip to content

Commit

Permalink
Fix redo stack loss when editing text literals (#11908)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitvakatu authored Dec 30, 2024
1 parent 6e5d902 commit a39560b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
- A constructor or type definition with a single inline argument definition was
previously allowed to use spaces in the argument definition without
parentheses. [This is now a syntax error.][11856]
- [Redo stack is no longer lost when interacting with text literals][11908].
- Symetric, transitive and reflexive [equality for intersection types][11897]

[11777]: https://github.com/enso-org/enso/pull/11777
[11600]: https://github.com/enso-org/enso/pull/11600
[11856]: https://github.com/enso-org/enso/pull/11856
[11908]: https://github.com/enso-org/enso/pull/11908
[11897]: https://github.com/enso-org/enso/pull/11897

# Next Release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ const graph = useGraphStore()
const input = ref<ComponentInstance<typeof AutoSizedInput>>()
const widgetRoot = ref<HTMLElement>()
const previousValue = ref<string>()
const editing = WidgetEditHandler.New('WidgetText', props.input, {
start() {
previousValue.value = textContents.value
},
cancel() {
editedContents.value = textContents.value
input.value?.blur()
Expand All @@ -34,8 +39,11 @@ const editing = WidgetEditHandler.New('WidgetText', props.input, {
function accepted() {
editing.end()
if (props.input.value instanceof Ast.TextLiteral) {
if (previousValue.value === editedContents.value) return
const edit = graph.startEdit()
edit.getVersion(props.input.value).setRawTextContent(editedContents.value)
const value = edit.getVersion(props.input.value)
if (value.rawTextContent === editedContents.value) return
value.setRawTextContent(editedContents.value)
props.onUpdate({ edit })
} else {
let value: Ast.Owned<Ast.MutableTextLiteral>
Expand Down

0 comments on commit a39560b

Please sign in to comment.