Skip to content

Add document tab context menu #1664

Closed
Closed

Description

@flying-sheep

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.

Activity

  1. kevinushey commented on Jan 2, 2018

    @kevinushey
    Collaborator

    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!

  2. kevinushey commented on Feb 14, 2018

    @kevinushey
    Collaborator

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

  3. jmcphers commented on Feb 14, 2018

    @jmcphers
    Member

    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());
    }

  4. kevinushey commented on Feb 15, 2018

    @kevinushey
    Collaborator

    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());

  5. kevinushey commented on Mar 2, 2018

    @kevinushey
    Collaborator
  6. self-assigned this
    on Nov 11, 2020
  7. added a commit that references this issue on Nov 12, 2020
    082a931
  8. added this to the v1.4-juliet-rose milestone on Nov 13, 2020
  9. gtritchie commented on Nov 23, 2020

    @gtritchie
    Member

    Implemented via #8375

  10. 3 remaining items

  11. valerie-rstudio commented on Jan 27, 2021

    @valerie-rstudio

    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.
  12. gtritchie commented on Jan 28, 2021

    @gtritchie
    Member

    Looking into it, thanks for the detailed notes.

  13. gtritchie commented on Jan 29, 2021

    @gtritchie
    Member

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

  14. dmurdoch commented on Sep 26, 2021

    @dmurdoch
    Contributor

    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?

  15. jmcphers commented on Sep 27, 2021

    @jmcphers
    Member

    @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

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions