Diffgutter: simplify + fix race#3291
Merged
dmaluka merged 2 commits intomicro-editor:masterfrom May 14, 2024
Merged
Conversation
The callback passed to UpdateDiff() is superfluous: in the synchronous case screen.Redraw() is not needed anyway (since the screen is redrawn at every iteration of the main loop), and in the asynchronous case UpdateDiff() can just call screen.Redraw() directly.
When updateDiffSync() is called asynchronously, it should lock the line array when calling Bytes(), to prevent race if the line array is being modified by the main goroutine in the meantime.
f65afa9 to
5a159ce
Compare
JoeKar
approved these changes
May 12, 2024
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.
UpdateDiff()interface: remove unneeded callback (sinceUpdateDiff()can simply callscreen.Redraw()directly in the async case, and doesn't need to call it at all in the sync case).LineArrayinstead of single lines #3224).