diff --git a/Docs/Help-panel-tabs.png b/Docs/Help-panel-tabs.png new file mode 100644 index 000000000..a168bb8d1 Binary files /dev/null and b/Docs/Help-panel-tabs.png differ diff --git a/Docs/Help.md b/Docs/Help.md index f512cb43b..705058d5d 100644 --- a/Docs/Help.md +++ b/Docs/Help.md @@ -259,7 +259,28 @@ This screenshot shows a `Volumes` Quick List: ![Quick List](Help-panel-quicklist.png) ### Tabs -_to be written_ + +File panels support a tabbed interface, allowing multiple locations to be opened simultaneously on either the left or right pane. The tab bar appears automatically if more than one tab is open in a pane, but it can also be forced to always show via the menu `View > Show Tab Bar` or by using the hotkey `Cmd + Shift + T`. The screenshot below shows Nimble Commander's window with two tabs in the left pane and three tabs in the right pane: + +![Tabbed Interface](Help-panel-tabs.png) + +A new tab can be opened in several ways: + +- Menu `File > New Tab` or the `Cmd + T` hotkey creates a new tab with the same location. +- Pressing the "+" button next to the tab bar. A long click or right click will display a list of recently closed locations. +- Hitting the `Shift + Cmd + R` hotkey restores the last closed tab and activates it. +- `Alt + Cmd + Return` reveals the currently focused item in a new tab on the opposite pane. + +To switch the active tab, the following hotkeys can be used: + +- `Shift + Cmd + ]` or `Ctrl + Tab` to switch to the next tab. +- `Shift + Cmd + [` or `Ctrl + Shift + Tab` to switch to the previous tab. +- The `File Panels > Show Tab №1..№10` hotkeys can be assigned to activate a specific tab. + +To close tabs, you can use the following hotkeys: + +- `Cmd + W` - closes the current tab. +- `Alt + Cmd + W` - closes all other tabs. ### Favorites _to be written_ diff --git a/Source/NimbleCommander/NimbleCommander/States/FilePanels/MainWindowFilePanelState+TabsSupport.mm b/Source/NimbleCommander/NimbleCommander/States/FilePanels/MainWindowFilePanelState+TabsSupport.mm index 30b1a06f5..f79417cea 100644 --- a/Source/NimbleCommander/NimbleCommander/States/FilePanels/MainWindowFilePanelState+TabsSupport.mm +++ b/Source/NimbleCommander/NimbleCommander/States/FilePanels/MainWindowFilePanelState+TabsSupport.mm @@ -211,19 +211,25 @@ - (void)showAddTabMenuForTabView:(NSTabView *)aTabView - (void)respawnRecentlyClosedCallout:(id)sender { - if( auto menu_item = nc::objc_cast(sender) ) { - auto any_holder = nc::objc_cast(menu_item.representedObject); - if( !any_holder ) - return; + AnyHolder *payload = nil; - if( auto request = std::any_cast(&any_holder.any) ) { - const auto tab_view = request->side == RestoreClosedTabRequest::Side::Left - ? m_SplitView.leftTabbedHolder.tabView - : m_SplitView.rightTabbedHolder.tabView; - [self spawnNewTabInTabView:tab_view loadingListingPromise:request->promise activateNewPanel:true]; - if( m_ClosedPanelsHistory ) - m_ClosedPanelsHistory->RemoveListing(request->promise); - } + if( auto popover_item = nc::objc_cast(sender) ) { + payload = nc::objc_cast(popover_item.representedObject); + } + else if( auto menu_item = nc::objc_cast(sender) ) { + payload = nc::objc_cast(menu_item.representedObject); + } + + if( !payload ) + return; + + if( auto request = std::any_cast(&payload.any) ) { + const auto tab_view = request->side == RestoreClosedTabRequest::Side::Left + ? m_SplitView.leftTabbedHolder.tabView + : m_SplitView.rightTabbedHolder.tabView; + [self spawnNewTabInTabView:tab_view loadingListingPromise:request->promise activateNewPanel:true]; + if( m_ClosedPanelsHistory ) + m_ClosedPanelsHistory->RemoveListing(request->promise); } }