Bug 480383

Summary: Undo operation not returning video to correct position, after adjusting subtitle, if subtitle snaps to video
Product: [Applications] kdenlive Reporter: red_Arti <jijiliu35>
Component: User Interface & MiscellaneousAssignee: Jean-Baptiste Mardelle <jb>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git-master   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: bug-undo-subtitle-snapping

Description red_Arti 2024-01-27 06:42:22 UTC
Created attachment 165265 [details]
bug-undo-subtitle-snapping

SUMMARY
(Watch screen video I uploaded in attachment)

STEPS TO REPRODUCE
1. Create project
2. Add video clip to timeline
3. Add some subtitles to timeline
4. Group everything in timeline
5. Cut the grouped bunch into 2 parts
6. Move 1st part to left

7. Drag and adjust a subtitle start position in the 2nd part, drag toward left. Keep mouse button down

8. Drag subtitle to the same start position as video. Keep mouse button down. Subtitle snaps to video. Keep mouse button down

9. Continue drag toward left. Mouse up and  finish a drag-adjust operation.
10. Undo

OBSERVED RESULT
The subtitle return back to old position. The video "return back to" the same position as subtitle, which is wrong

EXPECTED RESULT
Video should return back to where the video was

SOFTWARE/OS VERSIONS
Tested on:
1. Latest CI build qt6 AppImage
2. Latest CI build 23.08 branch AppImage

ADDITIONAL INFORMATION
(Watch screen video I uploaded in attachment)
Comment 1 Jean-Baptiste Mardelle 2024-01-29 19:45:20 UTC
Thanks for your report and details.
Should be fixed by my last commit (I pasted the wrong bug id):
https://invent.kde.org/multimedia/kdenlive/-/commit/57721eb6ef4a5772f688757ff80cec1ca8f8bd2f
Comment 2 red_Arti 2024-02-04 06:03:37 UTC
Hmm.. This bug not fixed. 
Still on today's git master ci build kdenlive-master-7375-linux-gcc-x86_64.AppImage (24.04.70 git 8870cce9 )
Comment 3 Jean-Baptiste Mardelle 2024-02-04 14:52:35 UTC
Strange... I just tested again with the Qt6 Appimage 7375 build but cannot reproduce... Can you please double check ?
Comment 4 red_Arti 2024-02-05 01:43:11 UTC
I did more tests, by draging the left edge of a subtitle (resizing it, just like in the video), which grouped with video.

9/10 times I can reproduce the bug.
1/10 time no bug (don't know why...)

Tested many times, with many random moving, ungrouping then grouping, cutting ...
Comment 5 Jean-Baptiste Mardelle 2024-02-05 17:34:22 UTC
So watching again and again at your video, I was finally able to reproduce. The key element is that the group must be unselected before attempting to resize the subtitle. 
I will work on it now.
Comment 6 Jean-Baptiste Mardelle 2024-02-05 19:12:58 UTC
Git commit 1a69139dfd62c5330e84d3deca0d17db733dd3a6 by Jean-Baptiste Mardelle.
Committed on 05/02/2024 at 19:12.
Pushed by mardelle into branch 'release/24.02'.

Subtitle items don't have a grouped property - fixes resize bug

M  +5    -0    src/timeline2/model/timelinemodel.cpp
M  +2    -0    src/timeline2/model/timelinemodel.hpp
M  +2    -2    src/timeline2/view/qml/SubTitle.qml

https://invent.kde.org/multimedia/kdenlive/-/commit/1a69139dfd62c5330e84d3deca0d17db733dd3a6
Comment 7 Jean-Baptiste Mardelle 2024-02-05 19:14:19 UTC
Should now be fixed, would be great if you can confirm.
Comment 8 red_Arti 2024-02-06 02:04:56 UTC
Yes. Fixed. 
Thank developers