Skip to content

Close All Others context menu command not closing all others #8855

Closed

Description

@gtritchie

System details

RStudio Edition : Desktop or Server
RStudio Version : 1.4.1532
OS Version      : any
R Version       : any

Steps to reproduce the problem

Found by @valerie-rstudio during verification of #1664

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

Describe the problem in detail

  • All documents close.

Describe the behavior you expected

  • All documents except the one that you right-clicked on should close.
  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting a RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added this to the v1.4-juliet-rose milestone on Jan 29, 2021
  2. self-assigned this
    on Jan 29, 2021
  3. jmcphers commented on Feb 1, 2021

    @jmcphers
    Member

    Is this the same behavior you get when you use the Close All Others command from the menu? (If so, probably not urgent to fix for Juliet Rose; maybe we could remove from the doc tab menu until we have an implementation that works the way people expect)

  4. gtritchie commented on Feb 1, 2021

    @gtritchie
    MemberAuthor

    I tried to determine that when opening this issue, and hit variations in behavior with multiple attempts even within the same entry point (context menu vs. main menu).

    Possibly a timing issue and/or focus issue, possibly a subtle order of operations issue, so needs more investigation before I can say. There are some differences in the code paths taken since the main menu command only works on the currently selected tab, whereas the context menu command operates on whichever document tab you right-clicked on, even if it's not the currently selected tab.

  5. melissa-barca commented on Feb 4, 2021

    @melissa-barca
    Contributor

    FWIW I can consistently reproduce this via the context menu when the last editor with focus is in a different column from the one I'm entering the context menu in.
    e.g. If I type in one column, then immediately right-click a tab in another column and select 'Close All Others', all tabs will close.
    Since there is one File menu for all columns, I'm not able to reproduce the behavior. It always closes all but the last one with focus.

  6. gtritchie commented on Feb 4, 2021

    @gtritchie
    MemberAuthor

    Investigation note, the problem stems from use of activeColumn_ (below) when checking to see if editor being closed is the one that is supposed to stay open. If document's whose tab was right-clicked is in a different source column than the last active document, then this check will fail and the document will close.

    if (!StringUtil.isNullOrEmpty(excludeDocId) && target == activeColumn_.getDoc(excludeDocId))

  7. melissa-barca commented on Feb 4, 2021

    @melissa-barca
    Contributor

    @gtritchie When you add the items to the menu you'll want to use SourceAppCommands rather than traditional commands and include the column the command is acting on. We have an example of this here: https://github.com/rstudio/rstudio/blob/master/src/gwt/src/org/rstudio/studio/client/workbench/views/source/editors/text/TextEditingTargetWidget.java#L397-L398

  8. gtritchie commented on Feb 4, 2021

    @gtritchie
    MemberAuthor

    @melissa-barca I didn't want the appearance of our full-blown menus (icons, shortcuts). The column is already available with the existing technique (see the PR).

  9. valerie-rstudio commented on Feb 24, 2021

    @valerie-rstudio

    Verified Fixed

    RStudio Edition : Desktop
    RStudio Version : 1.4.1591
    OS Version      : mac OS 11.2.1
    R Version       : 4.0.3
    

    Verified that the Close All Others option in the context menu is working as expected with single or multiple source panes open and with or without unsaved documents open. The option was tested in various scenarios when selected from in focus / out of focus documents across multiple source panes.

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