Feat/add close all tabs - #2863
Open
TonyGeez wants to merge 5 commits into
Open
Conversation
Contributor
Greptile SummaryThis PR introduces a tab context menu for closing the selected tab, its pane group, or neighboring tabs, and integrates it with both draggable tab bars and the sidebar file list.
Confidence Score: 4/5The PR should not merge until sidebar long presses tolerate normal touch movement; the keyboard-access issue should also be addressed. Sidebar handling treats every touchmove as scrolling, so realistic finger jitter after a long press cancels the new menu before release; the rendered menu also exposes focusable actions without a working keyboard activation path. Files Needing Attention: src/handlers/tabContextMenu.js Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Tab context-menu gesture] --> B{Tab location}
B -->|Top or bottom bar| C[Start drag session]
C --> D{Movement exceeds 8px?}
D -->|Yes| E[Complete drag or reorder]
D -->|No| F[Open tab context menu]
B -->|Sidebar| G[Wait for pointer release]
G --> H{Any touchmove?}
H -->|Yes| I[Cancel menu request]
H -->|No| F
F --> J{Selected action}
J --> K[Close pressed tab]
J --> L[Close pane group or all sidebar tabs]
J --> M[Close tabs to left]
J --> N[Close tabs to right]
Reviews (1): Last reviewed commit: "rm local tools" | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a context menu to file tabs, opened via long press (touch) or right click (desktop) to quickly close the current file, all open files in the group, or all tabs to the left/right of the pressed tab.
What's changed
src/handlers/editorFileTab.js— Distinguishes a long press from an actual tab drag using a pointer-slop threshold. When a press ends without moving (didDrag === false), the drag is finished and the tab context menu is opened instead.src/handlers/tabContextMenu.js(new) — Renders and positions the context menu next to the pressed tab, flipping horizontally/vertically when near the screen edge. It also guards against synthetic "click" events fired after touch gestures so menu items aren't accidentally activated on release.src/lib/editorFile.js— Wires up the context menu for both layouts:openTabContextMenuOnRelease).src/lib/commands.js— Adds two commands that run throughacode.exec(so the same prompts/flows as the rest of the app are used):close-tab— close the specific pressed file (not necessarily the active one).close-tabs-in-group— close every tab in the pressed file's pane/tab group; in the sidebar layout this closes all open files.close-tabs-to-left/close-tabs-to-right.Menu options
close-tabclose-tabs-in-groupclose-tabs-to-leftclose-tabs-to-rightTesting
Notes
strings(e.g.close file,close all) when translations exist; a hard-coded fallback is used otherwise.