Skip to content
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

Call fish_prompt after printing 'Job has ended' #1018

Closed
maxfl opened this issue Sep 26, 2013 · 6 comments
Closed

Call fish_prompt after printing 'Job has ended' #1018

maxfl opened this issue Sep 26, 2013 · 6 comments
Assignees
Milestone

Comments

@maxfl
Copy link
Contributor

maxfl commented Sep 26, 2013

If there is a number of background jobs printed in fish_prompt, it's not updated when some job ends. It seems that fish simply redraws the last prompt while it could call fish_prompt again.

@alexanderkyte
Copy link

That callback might be computationally costly. Also, it's hard to think of how that should work with the history. I'm not against the idea, but how it behaves sounds like a matter of taste.

@maxfl
Copy link
Contributor Author

maxfl commented Sep 27, 2013

@alexanderkyte, why do you think it will be computation costly? fish_prompt is called only in interactive mode on every 'enter' or after foreground job is finished. I'm sure there will be minimal impact if it will be called after background job finishes.

A solution might be in introducing a 'function --on-job-exit all' capability to call a user function on each job exit.

@alexanderkyte
Copy link

If you space it out long enough I'm sure it's fine. I was just picturing the 'immediate' use case. I'm not sure if there's a way to make a 'callback' on thread exit, and busy waiting like that could scale poorly in the presence of many, many shells.

Actually, we could accomplish this by passing a callback function pointer to a 'supervisor' thread responsible for spawning new background processes, or do it one of a hundred different ways. I'm just trying to think of a way that doesn't add too much unnecessary complexity. Then again, there are probably other features that realtime updates would enable. Having a clock in your prompt is an immediate thought.

@maxfl
Copy link
Contributor Author

maxfl commented Sep 27, 2013

@alexanderkyte, I'm still a bit confused. I'm talking only about current shell's background jobs which are anyway controlled by current shell. On exit of a background job fish anyway prints a message, so there is not much effort on updating fish_prompt after it.

It would be indeed expensive to follow all started system applications, but it's not the case.

@krobelus
Copy link
Member

krobelus commented May 19, 2020

With #6959 fish can be configured to do this by overriding fish_job_summary to add commandline -f repaint. Maybe this should be the default.

@zanchey
Copy link
Member

zanchey commented May 21, 2020

@krobelus, that sounds sensible to me.

@krobelus krobelus self-assigned this May 22, 2020
@krobelus krobelus modified the milestones: fish-future, fish 3.2.0 May 22, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants