Fix plugin loses track of current state#54
Open
jofserponcon wants to merge 1 commit intowill133:masterfrom
Open
Fix plugin loses track of current state#54jofserponcon wants to merge 1 commit intowill133:masterfrom
jofserponcon wants to merge 1 commit intowill133:masterfrom
Conversation
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.
To fix the following scenario:
1- diff 2 directories
2- open a
differ3-
Enter/ooutside of thedifferoronly inrange (e.g., on any of the 6 first lines)4- open again the same
differline as in 2-(Neovim 0.10.4 on MacOS)
=> The diff state is then broken:
differoronly inlineIt seems to me that in the function
DirDiffOpen(), we try too late to manage the case where we hit a non diff/only line.After 3-:
b:currentDiffrefers to the new non-diff lines:FilenameAands:FilenameBnow contain the names of directories[A]and[B]respectively.On 4-, when we enter
DirDiffOpen()again, we don't exit the function right away becauseb:currentDiffdoes not match. Why not.However, when we finally enter this block, the call to
bufnr(directory A)returns the same buffer number as that of the actual file A in diff. So, we basically delete the buffer we just entered.I think that the easiest is, during step 3, leave things as immaculate as possible:
like, if we see that we are not on a
differoronlyline, we just leave, which is what I propose in this PR.