Describe the bug
When a note has a custom independent title and only 1 line in its body (e.g.
☐ Task item), the tab hover preview card (and library list subtitle)
mistakenly renders "Empty note" / blank preview instead of showing the first
line.
Root cause
In NotePreviewCard (DeckViews.swift) and Note.preview (Core.swift),
the preview extraction logic unconditionally drops the first line
(lines.dropFirst()) and checks lines.count <= 1:
let lines = note.body.split(whereSeparator: \.isNewline).map(String.init)
let previewLines = Array(lines.dropFirst().prefix(4))
...
} else if note.body.isEmpty || lines.count <= 1 {
Text(L10n.text("note.empty"))
}
This assumption was based on the old behavior where the first line was
strictly used as the title. Now that notes support custom independent titles,
the first line of the body is actual content and should be included in the
preview when note.hasCustomTitle is true.
Expected behavior
- If note.hasCustomTitle == true: Preview should start from line 1 of the
body.
- If note.hasCustomTitle == false: Preview keeps skipping line 1 (as it's
already displayed as the derived title).
Describe the bug
When a note has a custom independent title and only 1 line in its body (e.g.
☐ Task item), the tab hover preview card (and library list subtitle)mistakenly renders
"Empty note"/ blank preview instead of showing the firstline.
Root cause
In
NotePreviewCard(DeckViews.swift) andNote.preview(Core.swift),the preview extraction logic unconditionally drops the first line
(
lines.dropFirst()) and checkslines.count <= 1: