Skip to content

fix: wrap a timed event's title over the room its block has #126 - #135

Merged
rathlinus merged 1 commit into
bulwarkmail:mainfrom
wmcparla:fix/calendar-event-title-wrap-126
Nov 15, 2026
Merged

rathlinus merged 1 commit into
bulwarkmail:mainfrom
wmcparla:fix/calendar-event-title-wrap-126

Conversation

@wmcparla

Copy link
Copy Markdown
Contributor

Summary

#126: in the day and week grids a timed event's title was always one line (numberOfLines={1}), however tall its block, so a long title ended in "…" even with room below it. This lets the title wrap over as many lines as the block has room for, after its padding and the start-time line under it (shown from 45 minutes). Short events keep one line.

Changes

  • calendar-time-grid.ts: timedTitleLines(height, withTimeLine, fontScale) counts the lines that fit, never fewer than one. The two line heights (15 and 13) move here as constants so the block's styles and the count share them.
  • EventBlock.tsx: TimedEventBlock takes the block's height as a prop (it was part of style) and sets the title's numberOfLines from it, with the system text size from useWindowDimensions() (line heights grow with it).
  • WeekView.tsx, TimeGridScrollView.tsx: pass height instead of putting it in style.
  • calendar-time-grid.test.ts: line counts for 15 min to 2 h blocks, at 1.0 and 1.3 text size.

Related issues

Closes #126

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactor / code quality improvement
  • Chore / dependency update / CI change

Checklist

  • I have read the Contributing Guide
  • My code follows the project's code style and conventions
  • I have run npm run typecheck and there are no errors (native has no lint script)
  • The build passes (no npm run build in native; an x86_64 release APK, assembleGithubRelease -PallowDebugSignedRelease=true, builds and runs)
  • I have tested my changes locally
  • I have added or updated documentation if needed (none needed)
  • I have updated translations (locales/) if my changes affect user-facing text (no user-facing text changed)
  • I have included screenshots or a screen recording for UI changes

Tests: npx vitest run: 7107 passed, 163 skipped (the live Stalwart suites), 0 failed.

Tested by hand on the Android 16 emulator (1080x2424, 420 dpi), upstream b3b4230 against this branch, with four events seeded on one day: 30 min, 1 h and 2 h with long titles, and 3 h with a short one. Lines counted from the title's height in the view hierarchy; the start time checked to be drawn whole inside its block:

Event Before After (text size 1.0) After (1.3)
30 min, long title 1 line 1 line 1 line
1 h, long title, day view 1 line + time 2 lines + time 1 line + time
1 h, long title, week view 1 line + time 2 lines + time
2 h, very long title 1 line + time 5 lines + time 3 lines + time
3 h, short title 1 line 1 line 1 line

Not tested: iOS (same component; fontScale follows Dynamic Type there), a tablet.

Screenshots / demo

Day view, before after
Every event title is cut to one line The 1 h and 2 h titles wrap over the room in their blocks
Week view, before after
Titles cut to a few letters Titles wrap in the narrow columns

Notes for reviewers

  • Only the timed blocks change. All-day bars and month view chips are fixed one-line rows with no room to wrap into, so they keep numberOfLines={1}. The webmail's grids also truncate to one line.
  • In the week grid a long word breaks mid-word ("Wrap12 / 0 quart / erly"), as Android does when a word is wider than the column. It reads better than "Wra…", but it is a change in look.
  • At a larger text size the count is conservative: Android scales the small time line less than the title (it stays 35 px at 1.3 here), so the count leaves a little spare room rather than cutting the time.

🤖 Generated with Claude Code

@wmcparla
wmcparla marked this pull request as ready for review November 13, 2026 20:41
@bulwark-warden

Copy link
Copy Markdown

I found no problems. CI's test job passes. EVENT_BLOCK_INSET = 4 is the right figure: the block has borderWidth: 1 and paddingVertical: 1 (EventBlock.tsx). The test's block() helper uses the same height formula as the grid (TimeGridScrollView.tsx). TimedEventBlock is only used in WeekView.tsx and TimeGridScrollView.tsx, and this PR updates both to pass the new height prop.

Bulwark Warden is an AI assistant and can be wrong. It answers from the docs, the code and earlier issues, and links its sources.

@rathlinus
rathlinus merged commit 5ccdf99 into bulwarkmail:main Nov 15, 2026
1 check passed
@rathlinus

Copy link
Copy Markdown
Member

Thanks, merged. Since #152 went in right after, I made the title wrap only into the room above an event drawn over the block, so no line ends up underneath.

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.

[Feature]: wrap text on long calendar entries

2 participants