Skip to content

Added a rustdoc shortcut for collapse/expand all #33765

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

Merged
merged 1 commit into from
May 22, 2016

Conversation

alex-ozdemir
Copy link
Contributor

Now when the user presses the "+" key all sections will collapse/expand.

Also added a note to the help screen which describes this behavior.

This required increasing the height of the help screen.

Now when the user presses the "+" key all sections will collapse/expand.

Also added a note to the help screen which describes this behavior.
@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cmr (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@GuillaumeGomez
Copy link
Member

I'm not so sure this is a good idea. For example, what happens if I want to scroll in and press CTRL+"+"?

@alex-ozdemir
Copy link
Contributor Author

That's a valid concern. Do you think having such a shortcut is a bad idea, or we should just use a better (more un-ambiguous) key?

@GuillaumeGomez
Copy link
Member

Both I guess. I don't see a case where we'd need to expand all items at once. But maybe I'm wrong?

cc @Manishearth @steveklabnik

@alex-ozdemir
Copy link
Contributor Author

alex-ozdemir commented May 22, 2016

The experience I had in mind was when someone is searching through documentation for something that will let them do "X" (such as, trying to figure out how to unwrap an option or get some default value - unwrap_or). Currently the interface is great for finding pages quickly (I.E. (Shift-S)+(type 'Option')+[:arrow_down:]+[Return].), but in particular it's harder to find a particular function that does what you want, because all the detailed explanations get in your way.

What you really want is to peruse a summary of functions, then more closely investigate those whose names/type signatures align with your idea. The collapsed mode shows these names and signatures clearly, while the expanded mode makes them a bit harder to see. Switching from the starting all-expanded mode to the all-collapsed mode currently requires the mouse; you must click on the [+/-] button in the upper right. It would be smoother if one could continue to just use the keyboard.

I hypothesize (but could be incorrect) that the above search & peruse workflow is worth improving. We could do so in a few ways, but I think the minimal change is to introduce a shortcut for the collapse/expand button. Alternatively, we could have the collapsed mode be the mode that the page starts in, or introduce a method list (like Java Doc), but I think these both have more substantial drawbacks.

The reason for making a collapse/expand shortcut rather than just a collapse shortcut is in some sense simplicity. A collapse/expand shortcut would just be a keyboard shortcut for the (already existing) [+/-] button, rather than a new type of action.

Maybe I'm thinking too hard about something pretty small - one could reasonably argue the value/complexity ratio of the change is not favorable.

@Manishearth
Copy link
Member

@bors r+
I agree

@bors
Copy link
Collaborator

bors commented May 22, 2016

📌 Commit ab09fbc has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented May 22, 2016

⌛ Testing commit ab09fbc with merge e24d621...

bors added a commit that referenced this pull request May 22, 2016
Added a `rustdoc` shortcut for collapse/expand all

Now when the user presses the "+" key all sections will collapse/expand.

Also added a note to the help screen which describes this behavior.

This required increasing the height of the help screen.
@bors bors merged commit ab09fbc into rust-lang:master May 22, 2016
@GuillaumeGomez
Copy link
Member

@Manishearth: The problem wasn't solve. In case you want to scroll in, it'll also expands everything. ><

@Manishearth
Copy link
Member

Could you make another PR to switch the keybinding to something that's not already taken?

@GuillaumeGomez
Copy link
Member

Meanwhile, I'll open an issue about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants