-
Notifications
You must be signed in to change notification settings - Fork 331
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
Avoid refreshing previews for async shell commands #1164
Avoid refreshing previews for async shell commands #1164
Conversation
@joelim-work Thanks a lot for the patch. Since I need to describe this change in the changelog soon, could you provide me the proper context for this in a simple manner? I wasn't able to follow all the changes and discussions about this. From what I understand:
Does that sound right? |
Hi @gokcehan, I agree that the conversation in #414 is a bit hard to follow because there are actually two issues being described:
This pull request addresses only the second issue. When a file is opened, the
For the purposes of the changelog, I suppose you can just say that the preview is no longer redrawn if an async shell command is called. |
I'm not 100% sure about this, but I was thinking that it might be better to move the refresh to when the command finishes, in the goroutine at
Let me know if you have any thoughts about this. I'll think if I can come up with an example where it's useful. |
Hi @ilyagr, the original intention of this pull request was to avoid immediately refreshing the preview when launching an async command, but now that I think about it, it's also quite reasonable to refresh it when the async command actually finishes. I did notice that running a --- a/app.go
+++ b/app.go
@@ -614,6 +614,7 @@ func (app *app) runShell(s string, args []string, prefix string) cleanFunc {
if err := cmd.Wait(); err != nil {
log.Printf("running shell: %s", err)
}
+ app.ui.exprChan <- &callExpr{"load", nil, 1}
}()
case "$|":
return func() { Also please give me any example use cases you have, they are very important for testing purposes and PR descriptions. |
This pull request addresses a user complaint where previews are redrawn when opening a file, see #414 (comment) for more details.
I think this issue probably extends to running any other asynchronous shell commands which could take a while to complete (e.g.
tar
), and when this happens there is no point refreshing the preview immediately because the command would not have completed yet.