Skip to content

feat(studio): select rightward takes crossing clips, and a host can keep only Select and Split - #4755

Merged
miguel-heygen merged 3 commits into
mainfrom
studio/tool-menu-select-split
Sep 30, 2026
Merged

miguel-heygen merged 3 commits into
mainfrom
studio/tool-menu-select-split

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

What

Two changes to the timeline's select-around-the-playhead tools.

1. Select rightward now includes clips crossing the playhead. This changes OSS Studio's default behaviour. Select rightward (and ]) takes every clip still running at the playhead or later: a clip is picked when it ends after the playhead. Before, it picked only clips that start at or after the playhead, so a clip already playing under the playhead was skipped, and in the middle of a film it often selected nothing. Select leftward (and [) is unchanged: it already took every clip that started before the playhead, crossing clips included. A clip starting exactly at the playhead still goes to rightward and not leftward. The ] hint in the shortcuts panel now reads "Select clips running at or after the playhead".

2. A host can hide the two rows. TimelineToolbar gets showSelectAroundPlayhead?: boolean (default true). With false, the timeline tool menu lists only Select and Split; Select leftward and Select rightward are not shown. The [ and ] shortcuts keep working either way. Studio's own app passes nothing, so it is unchanged.

Why

"Select rightward" reads as "everything from here on". Skipping the clip under the playhead made it look broken mid-film, and it did not mirror leftward, which already included that clip.

A host app that embeds Studio wants a shorter tool menu with just the two tools, while keeping the keyboard shortcuts for people who know them. Today it cannot hide those rows without CSS reaching into Studio internals.

Related work

Same host-prop pattern as showHistory (#4739) and showKeyframes (#4680). The menu rows came in with #4714.

How

  • selectAroundPlayhead in playerStore.ts now passes the whole clip to its predicate. Leftward keeps start < playhead; rightward is start + duration > playhead. The menu rows and the [/] keys both call these store actions, so both pick up the change.
  • TimelineToolbar threads the prop to TimelineToolPicker, which appends the two rows only when it is true.
  • The name follows the store helper both rows call, selectAroundPlayhead in playerStore.ts.
  • The shortcuts are bound in appHotkeysDispatch.ts and call the store directly, not the menu, so hiding the rows leaves the keys alone.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

useAppHotkeys.test.ts, "select leftward / rightward": the fixture now has a clip crossing the playhead, one entirely before it, one starting exactly at it, and one entirely after.

  • [ selects the crossing clip and the clip entirely before it. It does not select the clip starting exactly at the playhead or the one after it. This already passed before the change, because leftward already included crossing clips.
  • ] selects the crossing clip, the clip starting exactly at the playhead and the clip entirely after it. It does not select the clip entirely before. Run against main's store, this test fails: expected [ 'at', 'late' ] to deeply equal [ 'at', 'early', 'late' ].

TimelineToolbar.test.tsx, "TimelineToolbar tool menu":

  • The menu opened with no prop lists the four rows. With showSelectAroundPlayhead: false it lists Select and Split. Run against main's picker, this test fails: expected [ 'Select', 'Split', …(2) ] to deeply equal [ 'Select', 'Split' ].
  • With the rows shown and with them hidden, [ and ] at the playhead select the same clips. With the [/] branch taken out of appHotkeysDispatch.ts, both cases fail: expected [] to deeply equal [ 'c0' ].

Also run, one file per command: playerStore.test.ts, ShortcutsPanel.test.tsx, TimelineHistoryButtons.dom.test.tsx, timelineChromeExports.test.tsx, pointerTargetSize.test.tsx, useAppHotkeys.test.ts, ui/Menu.test.tsx. Plus Studio tsc --noEmit, oxfmt --check and oxlint on the changed files.

In a browser, using Studio's dev app with a three-clip test composition (Title 0-4 s, Card 2-6 s, Outro 5-9 s):

  • Playhead at 3 s. On main, Select rightward selected only Outro. On this branch, it selected Title, Card and Outro (Title and Card cross the playhead). [ selected Title and Card on both.
  • Playhead at 1.5 s, with the prop set to false: the menu showed only Select and Split, ] selected Card and Outro, and [ selected Title.

Before

Studio on main, three-clip test composition, 1440x900, headless Chrome.

Select rightward with the playhead at 3 s selects only Outro. Title and Card are still playing under the playhead and are skipped.

Before: Select rightward at 3 s selects only Outro

The tool menu lists Select, Split, Select leftward and Select rightward.

Before: the tool menu with four rows

After

This branch, same composition. Select rightward with the playhead at 3 s selects Title, Card and Outro.

After: Select rightward at 3 s selects Title, Card and Outro

This branch, with the toolbar given showSelectAroundPlayhead={false} the way a host would pass it (for the capture only; Studio's own app passes nothing and still shows four rows). The menu lists Select and Split.

After: the tool menu with Select and Split only

@miguel-heygen miguel-heygen changed the title feat(studio): a host can keep only Select and Split in the timeline tool menu feat(studio): select rightward takes crossing clips, and a host can keep only Select and Split Sep 30, 2026
@miguel-heygen
miguel-heygen marked this pull request as ready for review September 30, 2026 07:45
@miguel-heygen
miguel-heygen added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 9a27b9f Sep 30, 2026
184 of 186 checks passed
@miguel-heygen
miguel-heygen deleted the studio/tool-menu-select-split branch September 30, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants