Skip to content

Feat/add close all tabs - #2863

Open
TonyGeez wants to merge 5 commits into
Acode-Foundation:mainfrom
TonyGeez:feat/add-close-all-tabs
Open

Feat/add close all tabs#2863
TonyGeez wants to merge 5 commits into
Acode-Foundation:mainfrom
TonyGeez:feat/add-close-all-tabs

Conversation

@TonyGeez

@TonyGeez TonyGeez commented Sep 8, 2026

Copy link
Copy Markdown

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:
    • Tab-bar layout (top/bottom): long press starts a drag; the menu opens when the drag ends without movement.
    • Sidebar layout: no tab drag, so the menu opens when the pointer is released (openTabContextMenuOnRelease).
  • src/lib/commands.js — Adds two commands that run through acode.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.
    • Reuses existing close-tabs-to-left / close-tabs-to-right.

Menu options

Option Action
Close file close-tab
Close all close-tabs-in-group
Close Left close-tabs-to-left
Close Right close-tabs-to-right

Testing

  • Long press a tab in the top tab-bar layout → menu opens, no accidental reorder/drag.
  • "Close all" closes every open file.
  • "Close Left"/"Close Right" close only the expected tabs.
  • Dragging a tab still works normally (no menu appears after a real drag).

Notes

  • New tab labels fall back to strings (e.g. close file, close all) when translations exist; a hard-coded fallback is used otherwise.
  • Menu positioning uses size estimates; exact placement may need minor tuning on very large/small screens.

@greptile-apps

greptile-apps Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This 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.

  • Adds drag-slop tracking so stationary tab-bar long presses open the menu.
  • Adds menu positioning, post-touch click suppression, and close actions.
  • Adds targeted and pane-group close commands through the shared command surface.
  • The sidebar gesture currently cancels on ordinary touch jitter, and menu actions lack keyboard activation.

Confidence Score: 4/5

The 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

Filename Overview
src/handlers/editorFileTab.js Adds an 8px movement threshold and opens the tab menu when a drag session ends without meaningful movement.
src/handlers/tabContextMenu.js Implements menu rendering and release handling, but sidebar touch jitter cancels valid gestures and menu items cannot be activated from the keyboard.
src/lib/commands.js Adds targeted-tab and pane-group close commands using the existing close and confirmation flow.
src/lib/editorFile.js Connects context-menu gestures to tab-bar and sidebar layouts.

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]
Loading

Reviews (1): Last reviewed commit: "rm local tools" | Re-trigger Greptile

Comment thread src/handlers/tabContextMenu.js
Comment thread src/handlers/tabContextMenu.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant