Skip to content

Keep the view in place when double-clicking a clip or track area - #12141

Merged
grliszas14 merged 1 commit into
audacity:masterfrom
grliszas14:double_click_frame_fix
Sep 16, 2026
Merged

grliszas14 merged 1 commit into
audacity:masterfrom
grliszas14:double_click_frame_fix

Conversation

@grliszas14

Copy link
Copy Markdown
Contributor

Resolves: #12013

  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

QA:

  • Testflow test cases have been run

@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: bbad88d1-735a-4470-8cce-d5490e2a9727

📥 Commits

Reviewing files that changed from the base of the PR and between 8007d41021bae752f3546355535878f332586b5d and 9fc85cd1bc695fa3fafce1b87bd826bf0ed9d78e.

📒 Files selected for processing (3)
  • src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TracksItemsView.qml
  • src/projectscene/tests/playcursorcontroller_tests.cpp
  • src/projectscene/view/playcursor/playcursorcontroller.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The play cursor now provides seekToTimeKeepingView, which preserves the current frame for one stopped seek. The controller consumes this one-shot state during position updates. Tests cover normal seeks, keep-view seeks, one-shot behavior, and paused or stopped updates. Track double-click handling uses the keep-view operation. Dragging clamps the cursor position to time zero or later. Playback-region updates remain unchanged.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant TracksItemsView
  participant PlayCursorController
  participant PlaybackState
  TracksItemsView->>PlayCursorController: seekToTimeKeepingView(startTime)
  PlayCursorController->>PlaybackState: seekTime(startTime)
  PlaybackState-->>PlayCursorController: playbackPositionChanged(startTime)
  PlayCursorController->>PlayCursorController: updatePositionX(startTime)
  PlayCursorController-->>TracksItemsView: retain the current view frame
Loading

Merge Risk: 🔵 Low · up to 846cf

A narrow sequence involving a negative seek at the project start can leave the view unchanged on the following ordinary seek. The behavior is localized but should be corrected.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The pull request also changes play-cursor dragging to clamp the timeline position to zero or later during press, movement, and release. This behavior does not implement or verify the issue #12013 requ… Remove the unrelated play-cursor clamping change, or move it to a separate pull request with its own requirement.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: keeping the view in place when double-clicking a clip or track area.
Description check ✅ Passed The description includes the issue link, change intent, required checklist sections, and QA section. The Testflow checkbox is not selected, but this is a non-critical omission.
Linked Issues check ✅ Passed The implementation satisfies issue #12013. TracksItemsView.qml uses seekToTimeKeepingView(...) for double-click seeking on clip items and track audio selections. PlayCursorController preserves t…
Full details: Out of Scope Changes check

Explanation

The pull request also changes play-cursor dragging to clamp the timeline position to zero or later during press, movement, and release. This behavior does not implement or verify the issue #12013 requirement about preventing view shifts on double-click.

Warning

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/musescore.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 9ccd6cc9-411c-4585-b841-287199e4212f

📥 Commits

Reviewing files that changed from the base of the PR and between 52941d6 and 8007d41021bae752f3546355535878f332586b5d.

📒 Files selected for processing (4)
  • src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TracksItemsView.qml
  • src/projectscene/tests/playcursorcontroller_tests.cpp
  • src/projectscene/view/playcursor/playcursorcontroller.cpp
  • src/projectscene/view/playcursor/playcursorcontroller.h

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

void PlayCursorController::seekToTimeKeepingView(double secs)
{
if (!playbackState()->isPlaying()) {
m_keepViewOnSeek = true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Clear the flag when the seek does not dispatch.

If secs is negative and playback is already at zero, seekToTime() returns without a position update. Line 93 leaves m_keepViewOnSeek set. The next ordinary seek then consumes the flag and does not move the frame.

Make seekToTime() report whether it dispatched, or clear m_keepViewOnSeek when this call is a no-op.

@@ -198,7 +208,7 @@ void PlayCursorController::updatePositionX(muse::secs_t secs)
}
}
}
} else {
} else if (!keepView) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to avoid the smooth scroll right?

@grliszas14
grliszas14 force-pushed the double_click_frame_fix branch from 8007d41 to 9fc85cd Compare September 15, 2026 13:04
@grliszas14
grliszas14 force-pushed the double_click_frame_fix branch from 9fc85cd to 846cf9e Compare September 16, 2026 12:09
@grliszas14
grliszas14 merged commit 0b63c13 into audacity:master Sep 16, 2026
5 of 10 checks passed
@grliszas14
grliszas14 deleted the double_click_frame_fix branch September 16, 2026 12:09
kryksyh added a commit that referenced this pull request Sep 22, 2026
Keep the view in place when double-clicking a clip or track area (#12141)
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.

Don't shift frame on double-click

2 participants