Skip to content

Commit

Permalink
fix double breaks in WebVtt writer and bump version to 2.2.12.dev8
Browse files Browse the repository at this point in the history
  • Loading branch information
OlteanuRares committed Sep 10, 2024
1 parent 64ead7e commit ad3d54b
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 130 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Changelog
- Ignore repositioning commands which are not followed by any text before breaks.
- Mid-row codes will not add the space if is in front of punctuation.
- Fix a bug with background codes when InstructionNodeCreator collection is empty.
- Fix a bug WebVTT writer adding double line breaks.

2.2.12
^^^^^^
Expand Down
5 changes: 2 additions & 3 deletions pycaption/scc/state_machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ def update_positioning(self, positioning):
col = self._last_column
new_row, new_col = positioning
is_tab_offset = new_row == row and col + 1 <= new_col <= col + 3

# One line below will be treated as line break, not repositioning
if new_row == row + 1:
self._positions.append((new_row, col))
self._break_required = 1
self._positions.append((new_row, new_col))
self._break_required = True
self._last_column = new_col
# Tab offsets after line breaks will be ignored to avoid repositioning
elif self._break_required and is_tab_offset:
Expand Down
Loading

0 comments on commit ad3d54b

Please sign in to comment.