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

Add document tab context menu #1664

Closed
flying-sheep opened this issue Oct 25, 2017 · 11 comments
Closed

Add document tab context menu #1664

flying-sheep opened this issue Oct 25, 2017 · 11 comments

Comments

@flying-sheep
Copy link
Contributor

@flying-sheep flying-sheep commented Oct 25, 2017

Actions similar to Close, Close All, and Close All Except Current would make sense in a document tab’s context menu. I always find myself right-clicking tabs and expecting it.

Since Close and Close All Except This would refer to the right-clicked tab in the context menu, only Close All would reuse the closeAllSourceDocs action.

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Jan 2, 2018

Note, this requested is tracked in #7289

A similar request: https://support.rstudio.com/hc/en-us/community/posts/115007964793-Feature-suggestion-Copy-path-on-Source-tab-right-click-menu


I would like to suggest a feature to add to the right-click menu of the tabs in the Source panel, i.e. the list of opened scripts. This right-click menu currently only contains "Reload" and "Inspect" (like the right-click menu on the tabs of all the other panels).

It would be nice to have the option to "Copy file name" and "Copy full path", so I could paste this into my code (for use in source() commands). Currently, I have to to navigate to the source file outside of R to copy long file names, which is a minor nuisance.

Thank you!

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Feb 14, 2018

It would also be useful to have the ability to rename files within such a context menu. See also: #2199

@jmcphers
Copy link
Member

@jmcphers jmcphers commented Feb 14, 2018

It might be possible to do what we want by intercepting the right-click and drawing our own menu. If not (and/or we only want to do this for desktop), QtWebEngine supports custom context menus. We already do some customization here:

void WebView::contextMenuEvent(QContextMenuEvent *event)
{
// retrieve the context menu Qt wants to show
QMenu* menu = page()->createStandardContextMenu();
// list of actions we don't want it to show
std::vector<QWebEnginePage::WebAction> blockedActions =
{
QWebEnginePage::Back,
QWebEnginePage::Forward,
QWebEnginePage::ViewSource,
QWebEnginePage::Reload
};
// remove each from the menu if present
for (auto action: blockedActions)
{
menu->removeAction(page()->action(action));
}
// show the menu
menu->exec(event->globalPos());
}

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Feb 15, 2018

We also do this for the Git pane, directly from GWT:

screen shot 2018-02-14 at 6 23 50 pm

It looks like we could likely just add a GWT ContextMenuHandler as required?

addDomHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event)
{
MultiSelectCellTable.this.handleContextMenu(event);
}
}, ContextMenuEvent.getType());

@kevinushey
Copy link
Contributor

@kevinushey kevinushey commented Mar 2, 2018

Also, from https://community.rstudio.com/t/sort-source-file-tabs-alphabetically-in-ide/5760, a request to sort document tabs (e.g. alphanumerically)

@gtritchie
Copy link
Member

@gtritchie gtritchie commented Nov 23, 2020

Implemented via #8375

@valerie-rstudio
Copy link

@valerie-rstudio valerie-rstudio commented Jan 27, 2021

Verify Failed

RStudio Edition : Desktop
RStudio Version : 1.4.1522
OS Version      :  mac OS 11.1
R Version       :  4.0.2

Failure Points / Repro Steps

Close All Others context menu option fails to function as expected for documents in Source Editor.

  1. Open multiple documents in original Source Editor Pane.
  2. Click View -> Panes -> Add Source Column, and open multiple documents in the secondary Source Editor Column.
  3. Left-click on a document in the secondary column to bring it into focus.
  4. Right-click on any of the document tabs in the original column and choose Close All Others
  5. Expected: All documents except the one that you right-clicked on should close.
  6. Actual: All documents close.

Successful Verification Points

  • Verified that the Close context menu option functions as expected for Terminal and Jobs tabs. Also functions as expected for various document types both in and out of focus and across multiple columns for the Source Editor.
  • Verified the Close All context menu option functions as expected for various document types both in and out of focus and across multiple columns for the source editor.

@gtritchie
Copy link
Member

@gtritchie gtritchie commented Jan 28, 2021

Looking into it, thanks for the detailed notes.

@gtritchie
Copy link
Member

@gtritchie gtritchie commented Jan 29, 2021

Opened a new issue for the identified failure (#8855), closing this to mark the overall creation of context menu as completed.

@dmurdoch
Copy link
Contributor

@dmurdoch dmurdoch commented Sep 26, 2021

There was a pointer to this issue from https://community.rstudio.com/t/sort-source-file-tabs-alphabetically-in-ide/5760 a few years ago. However, it seems that request for a way to sort the tabs never made it into the context menu. Is there somewhere else where suggestions for this new context menu should be posted?

@jmcphers
Copy link
Member

@jmcphers jmcphers commented Sep 27, 2021

@dmurdoch Yup, just file them as a new issue.

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

No branches or pull requests

9 participants