Render differential updates by named segments instead of array index#913
Open
tompng wants to merge 2 commits into
Open
Render differential updates by named segments instead of array index#913tompng wants to merge 2 commits into
tompng wants to merge 2 commits into
Conversation
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.
Summary
render_line_differentialmatches the segments of each rendered line between the previous and the current frame to compute a minimal screen update. This matching used to be positional: a line was an array of[x, width, content]tuples where the array index doubled as the segment's identity (index 0 = prompt, 1 = input line, 2 = rprompt, 3.. = dialogs). Keeping identities stable required nil-padding and magic index offsets likedialog_rows[index + 3] = ..., which is fragile and hard to extend when adding a new kind of segment.This PR gives each segment an explicit identifier and changes the tuple to
[identifier, x, width, content]::builtin_prompt,:builtin_line,:builtin_rprompt,:builtin_menu:"dialog_#{dialog.name}"— thedialog_prefix isolates user-provided dialog names from the builtin identifiers and from the internal markers (:skip,:blank,:outdated)Idea for the future
I have an idea to add a completion preview if there is only one candidate, or there's a common prefix.
This PR will be a preparation for such change.