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

Redisplay last screen when "?" is entered at prompt. #297

Open
mrmachine opened this issue May 30, 2013 · 8 comments
Open

Redisplay last screen when "?" is entered at prompt. #297

mrmachine opened this issue May 30, 2013 · 8 comments
Labels

Comments

@mrmachine
Copy link
Collaborator

@mrmachine mrmachine commented May 30, 2013

In case another process has written to stdout and either overwritten the last screen or pushed it out of the scrollback buffer. In this case, simply re-displaying the key shortcuts for each choice without displaying the actual choices and the last screen is not much help.

@sampsyo

This comment has been minimized.

Copy link
Member

@sampsyo sampsyo commented May 30, 2013

This sounds like a good feature to have.

I do worry, though, that it will be somewhat complicated to implement. We'll have to add a new loop around every chunk of output we want to repeat, which might be daunting given how gnarly the control flow already is for those prompts. It would be great to find a simple way to implement this, but I'm not sure yet what that would be.

What sorts of output usually push prompts out of the scrollback? Maybe we would do well to address those (either also or instead). If it's just beets' own verbose output (beet -v), for example, maybe we should provide a way to dump that to a file so it doesn't interfere with the main interface.

@mrmachine

This comment has been minimized.

Copy link
Collaborator Author

@mrmachine mrmachine commented May 30, 2013

I noticed it with bad request errors in the discogs plugin, which I haven't silenced because I'm trying to work out what causes them and how to prevent them properly. I think the first one overwrites the prompt line, and subsequent output pushes everything up the screen.

However, I think it might be possible for any other process to write to console in this way as well and there's nothing we could do about it. This is probably an extreme edge case, e.g. severe errors when using a Linux system directly at the console, but IF it's not a major headache to implement (sounds like it could be), I think it would be a good UI behaviour to have.

Maybe we could avoid having to buffer the output so we could re-print it, by actually re-starting the current loop instead? This would mean re-calculating anything and re-making any API calls as well as re-printing output to stdout. I guess this is probably not a very nice idea :)

Otherwise, could we tap into the print_() function. Instead of writing to stdout it could write to a global buffer, and then at each loop or prompt in the code we print the buffer, and after each prompt where a valid choice is made, we clear the buffer and continue. If no valid choice is made, we re-print the buffer?

@mrmachine

This comment has been minimized.

Copy link
Collaborator Author

@mrmachine mrmachine commented May 30, 2013

Here is another example of some output from beets that is being printed to stdout while waiting at a prompt:

Started encoding /Users/tailee/dataset/Music.iTunes/Björk/Bastards/01 Crystalline (Omar Souleyman Remix).m4a
Encoding /Users/tailee/dataset/Music.iTunes/Björk/Bastards/01 Crystalline (Omar Souleyman Remix).m4a failed. Cleaning up...

@sampsyo

This comment has been minimized.

Copy link
Member

@sampsyo sampsyo commented May 30, 2013

Ah—we should definitely endeavor to hide this kind of output (logs from import-triggered plugins). Looks like this comes from the convert plugin; let's silence its output from its import stage.

On Thu, May 30, 2013 at 6:02 AM, Tai Lee notifications@github.com wrote:

Here is another example of some output from beets that is being printed to stdout while waiting at a prompt:
Started encoding /Users/tailee/dataset/Music.iTunes/Björk/Bastards/01 Crystalline (Omar Souleyman Remix).m4a

Encoding /Users/tailee/dataset/Music.iTunes/Björk/Bastards/01 Crystalline (Omar Souleyman Remix).m4a failed. Cleaning up...

Reply to this email directly or view it on GitHub:
#297 (comment)

@mrmachine

This comment has been minimized.

Copy link
Collaborator Author

@mrmachine mrmachine commented Jun 6, 2013

Just an idea. Might it be sufficient to add support for "hidden" or symbol options (like "?") to the input functions, and simply add a continue action for that option in the choose candidates function? Alternatively, we could add another visible option "re-Display" that does the same thing.

@sampsyo

This comment has been minimized.

Copy link
Member

@sampsyo sampsyo commented Jun 6, 2013

100% agree—it would be great if this option (and others like it) could be hidden from the prompt's list, which is already somewhat unwieldy.

@mrmachine

This comment has been minimized.

Copy link
Collaborator Author

@mrmachine mrmachine commented Jun 10, 2013

Here is another example of errors written to stdout pushing data off screen.

Chromaprint::FingerprintCalculator::Calculate() -- Not enough data. Image has 2 rows, needs at least 16 rows.
Chromaprint::FingerprintCalculator::Calculate() -- Not enough data. Image has 11 rows, needs at least 16 rows.

This was printed to stdout (number of rows varies) about 50 times.

@sampsyo

This comment has been minimized.

Copy link
Member

@sampsyo sampsyo commented Jun 10, 2013

That particular instance of extraneous should be fixed in beetbox/pyacoustid@8939e03 (pyacoustid v1.0.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.