Skip to content

Add right-click context menu to document tabs - #8375

Merged
gtritchie merged 7 commits into
v1.4-juliet-rosefrom
feature/doc-tab-context-menu
Nov 16, 2020
Merged

gtritchie merged 7 commits into
v1.4-juliet-rosefrom
feature/doc-tab-context-menu

Conversation

@gtritchie

@gtritchie gtritchie commented Nov 13, 2020 •

Copy link
Copy Markdown
Member

Intent

Most IDEs have a right-click menu on document tabs, enabling handy shortcuts to common document-level operations.

Fixes #1664

Approach

Add a context menu to RStudio document tabs containing "Close", "Close All", "Close All Others". No doubt many others will be requested (such as in #7289 and #8374), but for now getting these in as a start to wet people's appetites.

This required a small tweak to GWT, covered here: rstudio/gwt#8

The Close and Close All commands reuse existing functionality, but "Close All Others" is new and the reason for most of the changes; can't use the "Close All Except Current" since context menu lets you trigger the action on an unselected editor tab.

I also added a context menu to feature tabs that are closable (e.g. Terminal, Jobs), since people are likely going to start right-clicking on other tabs to see what happens. For feature tabs that can't be closed, right-clicking is now a no-op (instead of bringing up the browser context menu).

screenshot of context menu displayed for a document tab

screenshot of context menu displayed for the terminal tab

QA Notes

Test various combinations of tab types (dirty and clean source editors, viewers such as View(mtcars), and so forth, in the main source region, source columns, and/or satellite windows.

Also retest the File / Close All Except Current menu command, especially with multiple source columns.

@gtritchie gtritchie added this to the v1.4-juliet-rose milestone Nov 13, 2020

@kevinushey kevinushey left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@melissa-barca melissa-barca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good, but excludeDocId seems like a more generic excludeActive. What do you think about removing the excludeActive parameter and having onCloseOtherSourceDocs retrieve the doc id of the active editor and pass that in excludeDocId? I believe this is the only place we pass excludeActive as true to closeAllSourceDocs.

@gtritchie

Copy link
Copy Markdown
Member Author

...but excludeDocId seems like a more generic excludeActive

Ah, excellent idea. It felt wrong to have these two similar arguments that would never be used at the same time. I'll do that!

@gtritchie
gtritchie marked this pull request as draft November 14, 2020 22:12
@gtritchie

Copy link
Copy Markdown
Member Author

Set to draft while I make suggested refactoring.

@gtritchie
gtritchie marked this pull request as ready for review November 15, 2020 19:54

@melissa-barca melissa-barca left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Can you update the QA notes to include testing the Close All Except command? The original code for this was tricky with multiple columns.

@gtritchie
gtritchie merged commit 23d5653 into v1.4-juliet-rose Nov 16, 2020
@gtritchie
gtritchie deleted the feature/doc-tab-context-menu branch April 6, 2021 21:04
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.

3 participants