Skip to content

editor_ops: paste automation at leftmost selected point, not at timel…#1080

Open
pyrotek45 wants to merge 1 commit intoArdour:masterfrom
pyrotek45:fix/automation-paste-uses-leftmost-point
Open

editor_ops: paste automation at leftmost selected point, not at timel…#1080
pyrotek45 wants to merge 1 commit intoArdour:masterfrom
pyrotek45:fix/automation-paste-uses-leftmost-point

Conversation

@pyrotek45
Copy link

@pyrotek45 pyrotek45 commented Mar 14, 2026

When automation points are selected and copied (Ctrl+C / Ctrl+V or Ctrl+D), the pasted automation was placed far to the right of the paste cursor -- as if the entire automation lane from the start of the song was being copied rather than just the selected nodes.

Root cause: cut_copy_points() tracks the earliest selected point in order to normalise the copy buffer to zero-relative offsets before storing it. It initialised 'earliest' from the earliest_time parameter, which callers pass as timepos_t(AudioTime) == 0 samples. Since 0 is always <= any real event position on the timeline, std::min() always kept 0 as 'earliest'. shift_earlier(0) was then a no-op, leaving every event in the copy buffer at its raw model-space position (e.g. 30 seconds into the song). On paste, paste_one() adds model_pos (the paste cursor position) on top, producing raw_pos + cursor instead of just cursor.

Fix: seed 'earliest' from the first real event encountered rather than from the caller-supplied sentinel. Subsequent points are compared against that real baseline, so the leftmost selected node correctly becomes position 0 in the copy buffer, and paste lands exactly at the edit cursor regardless of where the automation sits on the timeline.

basically, the issue was, when selecting automation points and pasting it somewhere else, it would also paste the start of the automation lane, when it should just paste the nodes that you selected. i would expect it to paste the left most node that you selected where your cursor is.

related to this https://tracker.ardour.org/view.php?id=9771

…ine origin

When automation points are selected and copied (Ctrl+C / Ctrl+V or Ctrl+D),
the pasted automation was placed far to the right of the paste cursor -- as
if the entire automation lane from the start of the song was being copied
rather than just the selected nodes.

Root cause: cut_copy_points() tracks the earliest selected point in order
to normalise the copy buffer to zero-relative offsets before storing it.
It initialised 'earliest' from the earliest_time parameter, which callers
pass as timepos_t(AudioTime) == 0 samples.  Since 0 is always <=  any real
event position on the timeline, std::min() always kept 0 as 'earliest'.
shift_earlier(0) was then a no-op, leaving every event in the copy buffer
at its raw model-space position (e.g. 30 seconds into the song).  On paste,
paste_one() adds model_pos (the paste cursor position) on top, producing
raw_pos + cursor instead of just cursor.

Fix: seed 'earliest' from the first real event encountered rather than from
the caller-supplied sentinel.  Subsequent points are compared against that
real baseline, so the leftmost selected node correctly becomes position 0 in
the copy buffer, and paste lands exactly at the edit cursor regardless of
where the automation sits on the timeline.
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