Skip to content

Add subtitle grid text fit setting: clip / wrap / ellipsis (#11590)#11594

Open
muaz978 wants to merge 1 commit into
SubtitleEdit:mainfrom
muaz978:feature/grid-text-autofit
Open

Add subtitle grid text fit setting: clip / wrap / ellipsis (#11590)#11594
muaz978 wants to merge 1 commit into
SubtitleEdit:mainfrom
muaz978:feature/grid-text-autofit

Conversation

@muaz978

@muaz978 muaz978 commented Jun 13, 2026

Copy link
Copy Markdown

Implements #11590 - an auto-fit setting for the subtitle grid so the visible text adapts to the window size.

Background

The grid Text and Original columns were hardcoded to TextWrapping.NoWrap, so long lines are clipped at the column edge (you can't see the rest without widening) and multi-line subtitles produce very tall rows.

Change

Adds an appearance setting "Subtitle text fit in grid" (Settings -> Appearance) with three modes:

  • Clip (single line) - default, unchanged: NoWrap, long lines clipped at the edge.
  • Wrap to fit window - TextWrapping.Wrap; text reflows to the column width and rows grow to show the full text (this is what the screenshot in the issue shows).
  • Single line with ellipsis - NoWrap + MaxLines=1 + CharacterEllipsis; one compact line, truncated with an ellipsis that adapts to the column (window) width.

It is modelled on the existing grid-lines-visibility dropdown: a SubtitleGridTextDisplayMode enum + display list, persisted in SeAppearance.SubtitleGridTextDisplay (stored as the mode name, default Clip). The mode is applied where the Text/Original cell templates are built, so it takes effect when the grid is rebuilt on Settings OK - the same path GridCompactMode / grid-lines use. It composes with the existing SubtitleGridTextSingleLine join setting.

Notes

  • Default Clip preserves current behaviour exactly; no migration needed (missing/old setting parses to Clip).
  • English strings added in LanguageSettings.cs; other language JSONs fall back to those until translated.
  • Builds clean (0 warnings / 0 errors).
  • I don't have a Windows/macOS GUI here to judge the look, so I also produced portable Windows and macOS test builds from this branch so the feel of each mode (especially row growth in Wrap) can be confirmed. Happy to adjust defaults, naming, or where the setting lives.

@niksedk

niksedk commented Jun 14, 2026

Copy link
Copy Markdown
Member

New language string will have to wait for 5.0.1

@muaz978 muaz978 force-pushed the feature/grid-text-autofit branch 2 times, most recently from dc92b4a to a7702ca Compare July 1, 2026 08:44
@muaz978

muaz978 commented Jul 1, 2026

Copy link
Copy Markdown
Author

Rebased this branch onto the latest main. This is purely a sync, no functional changes: it just confirms this stays conflict-free and cleanly mergeable against current main.

@niksedk

niksedk commented Jul 1, 2026

Copy link
Copy Markdown
Member

Please add screenshots - also how does this work with the current one-line-setting with string separator?

@muaz978

muaz978 commented Jul 1, 2026

Copy link
Copy Markdown
Author

Screenshots coming shortly.

On how this composes with the existing "show subtitle text as single line" + separator setting: the two are independent layers and mostly compose cleanly.

SubtitleGridTextSingleLine / SubtitleGridTextSingleLineSeparator decide whether the break between a subtitle's line 1 and line 2 is rendered as a literal separator token (e.g. " ⏎ ") or a real line break, in TextWithSubtitleSyntaxHighlightingConverter.AppendLineSeparator.

The new display mode (Clip / Wrap / Ellipsis) is applied afterward, purely as TextWrapping / MaxLines / TextTrimming on the resulting text block, in SubtitleGridTextDisplayModeDisplay.ApplyTo. It has no knowledge of whether the break it is wrapping/trimming came from a real line break or a separator token.

One real edge case from that: with Ellipsis mode and the separator setting OFF (so subtitle lines keep a real line break), MaxLines = 1 cuts at the first physical line, so a 2-line subtitle shows only its first line plus a trailing ellipsis, line 2 is fully hidden rather than just visually cut off. With the separator setting ON there is no real line break to cut at, so this does not happen; the whole joined string (with the separator token inline) is what gets truncated.

If you would rather Ellipsis always show something from every original line (e.g. truncate each line's tail instead of dropping line 2 outright), that is a small follow-up change I am happy to make, just say the word.

@muaz978

muaz978 commented Jul 1, 2026

Copy link
Copy Markdown
Author
#11590 Please see the attached GIF.

…dit#11590)

The grid Text and Original columns were hardcoded to NoWrap, so long lines
were clipped at the column edge and multi-line subtitles produced very tall
rows. Add an appearance setting "Subtitle text fit in grid" with three modes
so the visible text can adapt to the window size:

- Clip (default, unchanged): no wrap, long lines clipped at the edge
- Wrap to fit window: text wraps to the column width, rows grow to fit
- Single line with ellipsis: one line, truncated with an ellipsis

Modelled on the existing grid-lines-visibility dropdown; the mode is applied
when the grid is (re)built (i.e. on Settings OK). Default Clip preserves the
current behaviour, and it composes with the existing single-line setting.
@muaz978 muaz978 force-pushed the feature/grid-text-autofit branch from a7702ca to a5cb781 Compare July 1, 2026 13:18
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