Time: in Frames style a typed number is a frame count (#610 follow-up)

parse_timecode reads bare digits as timecode pairs, so 00100 went to
frame 30 (1 s) instead of frame 100.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f
This commit is contained in:
Claude committed 2026-10-10 18:50:32 +00:00
1 parent a3cc4d04b0
commit 4de11be339
2 files changed
+20 -8

No files matched your search

+8 -3
View File
@@ -43,12 +43,17 @@ pub fn parse_display_time(s: &Session, comp: &Comp, text: &str, current: i64) ->
let relative = text.trim().starts_with('+') || text.trim().starts_with('-');
if relative {
Ok(parsed)
} else if st.time_display == TimeDisplayStyle::Frames
&& let Ok(frame) = text.trim().parse::<i64>()
{
// Displayed digits are a plain frame count (00100 is frame 100, not 1 s) plus
// Start Numbering Frames At.
Ok(frame.saturating_sub(st.frame_start))
} else if st.time_display == TimeDisplayStyle::Frames {
// Displayed digits are composition frame plus Start Numbering Frames At.
Ok(parsed - st.frame_start)
Ok(parsed.saturating_sub(st.frame_start))
} else {
// Displayed timecode includes the composition Start Timecode offset.
Ok(parsed - fr.frame_at(comp.display_start))
Ok(parsed.saturating_sub(fr.frame_at(comp.display_start)))
}
}
}
+12 -5
View File
@@ -413,11 +413,7 @@ fn time_set_snaps_to_the_nearest_frame_and_ae_timecode() {
#[test]
fn time_set_keeps_the_frame_shown_in_the_current_time_field() {
let mut s = Session::default();
s.execute(
"comp.new",
json!({"name": "Example", "width": 64, "height": 64, "frameRate": 30, "duration": 0.6, "startTimecode": "0:00:00:05"}),
)
.unwrap();
s.execute("comp.new", json!({"name": "Example", "width": 64, "height": 64, "frameRate": 30, "duration": 0.6, "startTimecode": "0:00:00:05"})).unwrap();
let r = s.execute("time.set", json!({"frame": 0})).unwrap();
assert_eq!(r["display"], "0:00:00:05");
let r = s.execute("time.set", json!({"timecode": "0:00:00:05"})).unwrap();
@@ -433,6 +429,17 @@ fn time_set_keeps_the_frame_shown_in_the_current_time_field() {
assert_eq!(r["frame"], 13);
}
/// Frames display style: typed digits are a frame count, so 00100 is frame 100, not 1 s (#530).
#[test]
fn time_set_reads_frames_style_digits_as_a_frame_count() {
let mut s = Session::default();
s.execute("comp.new", json!({"name": "Long", "width": 64, "height": 64, "frameRate": 30, "duration": 10})).unwrap();
s.execute("file.projectSettings", json!({"timeDisplay": "frames"})).unwrap();
let r = s.execute("time.set", json!({"timecode": "00100"})).unwrap();
assert_eq!(r["frame"], 100);
assert_eq!(r["display"], "00100");
}
#[test]
fn separate_dimensions_split_and_rejoin() {
let (mut s, l) = setup();