-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy to cliboard fails if the file has changed #21
Comments
The issue I see with this is if the some lines were changed before the current position, the resulting line number would be meaningless since the URL would point to some other location in the file. E.g.:
If you changed the file by repeating the first 3 lines:
And you have your cursor at The actual way to solve this would be to parse the I'm not sure fugitive's IMO, that is incorrect behavior. The way I see it, we can either:
|
@ruifm thanks for the detailed and timely response. Tbh the proper solution whilst ideal seems quite high effort. IMO a small step in the right direction would be a less red screen of death like error, something maybe unobtrusive that just says I think in terms of actually solving the issue though, tbh I think a guesstimation is not that bad, since I think a bit of common sense and documentation can overcome some of the difficulty. In a lot of situations the URL might be valid, and if it isn't, I think a user who has been modifying the file knows they've likely done it to themselves, and it's best effort. More often than not I'd rather take my chances in this case since if it returns a URL linking to line 25 instead of 28 at least by this point it's open to almost the correct place in my browser and at this point I can just click on the correct line and proceed 🤷🏾♂️ rather than the alternative of stashing my changes or more likely, opening the browser and navigating manually. EDIT: should have said a URL without line ranges is also perfectly acceptable, since you can then still get something usable you can add the correct range to in the browser if needed. I think the fix can also be iterative as better solutions become more feasible, rather than an immediate need to parse diffs etc. |
@ruifm I'll give it a try as well. Thanks for working on it 👍🏾 |
Describe the bug
A clear and concise description of what the bug is:
Whilst trying to copy a line to the clipboard in a file I had changed but not committed the plugin errors showing.
Error if the line is changed, but if the line is not changed then use the permalink from HEAD, since that part of the code is still unchanged in HEAD and so another developer would be able to use the link.
:GBrowse
does not fail in these situations I believe and uses HEAD as well I think.*What was the actual result?
If there has been any change at all to a file, any attempts to copy from it fail.
To Reproduce
Expected behavior
I believe that in the case of fugitive it does not throw an error if the file has been changed
I believe it must employ some heuristic to figure out the last sensible commit to base the permalink off presumably HEAD.
Screenshots
If applicable, add screenshots to help explain your problem.
System (please complete the following information):
neovim --version
: 0.5git --version
: 2.25.1Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: