Skip to content

Conversation

@pcochenn-harmonicinc
Copy link
Contributor

@pcochenn-harmonicinc pcochenn-harmonicinc commented Dec 30, 2025

Integer line values can be positive or negative. When positive, lines are counted from the top of the screen, and when negative, from the bottom of the screen.

The code did not handle negative values correctly, as line positions ended up greater than 100(%), hence out of the screen.
The fix handles negative values properly and adds a test case for both positive/negative integers and percentage.

Note that line value 0 should probably be handled as a positive value, but I did not change the current logic to remain backward compatible.

Closes #475

@palemieux palemieux self-requested a review December 30, 2025 17:02
@palemieux
Copy link
Contributor

Note that line value 0 should probably be handled as a positive value, but I did not change the current logic to remain backward compatible.

It looks like this should also be fixed since the spec states the following. I would fix it here unless you think a separate issue is necessary.

Positive line numbers count from the start of the video viewport (the first line is numbered 0), negative line numbers from the end of the video viewport (the last line is numbered −1).

Copy link
Contributor

@palemieux palemieux left a comment

Choose a reason for hiding this comment

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

As discussed at #476 (comment) , I suggest fixing the line: 0 bug here as well unless you think a separate issue should be opened.

@pcochenn-harmonicinc
Copy link
Contributor Author

You are absolutely right, thank you. I fixed the line:0 issue and added a test case for this.

@palemieux palemieux merged commit 55190a9 into sandflow:master Jan 2, 2026
2 checks passed
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.

VTT reader does not display cues with negative "line" attribute values

2 participants