#1996 Restore the macro-block caret synchronously after a live repaint - #1999
Merged
TimothyLuke merged 1 commit intoAug 22, 2026
Merged
Conversation
…live repaint RefreshMacroEditorColoredText repaints the coloured text with SetText, which parks the caret at the end, and only restored it via a deferred C_Timer.After(0) -- so a frame rendered with the caret (and the scroll view chasing it) at the end of the bottom line before it moved back: a visible flick on every live repaint, and a fast follow-up key acted at the end of the text. An unconditional deferred restore could also yank the caret back to a stale position one frame after a newer keystroke. Restore the caret synchronously right after SetText (the same SetText+SetCursorPosition-in-one-go approach IndentationLib has used for years). Keep the deferred restore only as a backstop: scheduled only if the immediate restore visibly did not take, and it re-checks that the text is still the text it was computed for before touching the caret. Colouring logic is untouched. Fixes TimothyLuke#1996 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1996
Problem
RefreshMacroEditorColoredTextrepaints withSetText(caret parks at the end) and restored the caret only via a deferredC_Timer.After(0)— so a frame rendered with the caret and scroll view at the end of the bottom line before it moved back (visible flick every live repaint), a fast follow-up key acted at the end, and the unconditional deferred restore could yank the caret to a stale position after a newer keystroke.Fix (1 file, Editor.lua)
Restore the caret synchronously right after
SetText(IndentationLib's long-standing SetText+SetCursorPosition-in-one-go approach). Keep the deferred restore only as a backstop: scheduled only if the immediate restore visibly did not take, and it re-checks the text is still the text it was computed for before touching the caret. Colouring logic untouched.Verified
In-game: no flick; fast typing/deleting stays put; the earlier #1959 behaviours (Enter row push, Backspace through commas, top-left Backspace) unaffected.
luac -pclean.🤖 Generated with Claude Code