Skip to content

feat(editor): add context menu for closing file tabs - #2863

Merged
bajrangCoder merged 10 commits into
Acode-Foundation:mainfrom
TonyGeez:feat/add-close-all-tabs
Sep 11, 2026
Merged

feat(editor): add context menu for closing file tabs#2863
bajrangCoder merged 10 commits into
Acode-Foundation:mainfrom
TonyGeez:feat/add-close-all-tabs

Conversation

@TonyGeez

@TonyGeez TonyGeez commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness or repository-rule issues identified.

Summary

  • Distinguishes stationary long presses from tab drags using an 8px movement threshold.
  • Opens the menu on pointer release in the sidebar layout.
  • Resolves explicit file references strictly so stale menus cannot close unrelated tabs.
  • Excludes disabled items and separators from keyboard navigation and activation.
  • The only change since the previous review corrects indentation in the keyboard activation helper.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Long press or right click on file tab] --> B{Tab-bar layout?}
    B -->|Yes| C[Start drag session]
    C --> D{Movement exceeds 8px?}
    D -->|Yes| E[Continue tab drag]
    D -->|No| F[Open context menu on release]
    B -->|No| G[Track pointer until release]
    G --> H{Movement exceeds 8px?}
    H -->|Yes| I[Cancel menu request]
    H -->|No| F
    F --> J{Selected action}
    J --> K[Close selected tab]
    J --> L[Close tabs in group]
    J --> M[Close tabs to left]
    J --> N[Close tabs to right]
Loading

Reviews (5) · Last reviewed commit: "biome file"

Comment thread src/handlers/tabContextMenu.js
Comment thread src/handlers/tabContextMenu.js
@bajrangCoder

This comment was marked as outdated.

Comment thread src/components/contextmenu/index.js
@bajrangCoder

This comment was marked as outdated.

Comment thread src/lib/commands.js Outdated
Comment thread src/components/contextmenu/index.js Outdated
Comment thread src/components/contextmenu/index.js
Comment thread src/components/contextmenu/index.js
Comment thread src/lib/commands.js Outdated
@TonyGeez TonyGeez closed this Sep 11, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Sep 11, 2026
@TonyGeez TonyGeez reopened this Sep 11, 2026
@bajrangCoder bajrangCoder changed the title Feat/add close all tabs feat(editor): add context menu for closing file tabs Sep 11, 2026
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder
bajrangCoder added this pull request to the merge queue Sep 11, 2026
Merged via the queue into Acode-Foundation:main with commit c768608 Sep 11, 2026
8 checks passed
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: Done

Development

Successfully merging this pull request may close these issues.

2 participants