-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Updating SaveCmd to use saveBufToFile instead #3689
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
Conversation
| if err != nil { | ||
| InfoBar.Error(err) | ||
| } | ||
| h.saveBufToFile(args[0], "SaveAs", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing action="SaveAs" will in the end cause executing onSaveAs lua callback, which is supposed to be executed by the SaveAs action, not by a command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the if block few lines above which calls Save() will also cause a lua callback. I don't mind either way to have an action or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the if block few lines above which calls
Save()will also cause a lua callback. I don't mind either way to have an action or not.
Good point. Ok, maybe some users are already relying on that, so let's stay consistent with this inconsistency...
This whole micro/internal/buffer/buffer.go Lines 471 to 485 in 7d16dcd
Initially on b.NewBuffer() b.name isn't set at all and thus "". When it is set one time, then there is the need to track it accordingly.We could get rid of this risk when we internally don't call b.SetName() but we've to keep these functions, since we export them and there is the risk to break plugins.
|
Using
saveBufToFile()to allow sudo prompt instead of just failing.Also, this fixes the bug where the name is not updated when newly saved buffer is saved again as a different file.
So for example if you create a new buffer (
AddTabfor example) and save asa.txt. Then save again asb.txt, the title is not updated since it is calling the bufferSaveAs()method directly.I have no idea how the name gets updated in other situations (for example open an existing file and saving it as another file) despite it calling the buffer
SaveAs()method directly.