fix(editor): source-editor spacing — blank lines are the separator (#71 follow-up 8)
Two defects from the flow-knob commit: (1) edit mode got reading-mode's paragraph spacing stacked on top of the visible blank source lines — gaps tripled. Source editors render the blank line AS the separator; paragraph spacing is now 0, only lineHeightMultiple rides the knobs. (2) Knob changes never reached an open editor — updateNSView now re-attributes the whole storage (selection preserved) when ProseTypography.flowKey moves.
This commit is contained in:
1 parent
6d7d1411a2
commit
677dc8c073
3 files changed
+22
-7
No files matched your search
@@ -40,15 +40,14 @@ nonisolated enum ProsePresenter {
|
||||
/// Paragraph spacing per line kind, applied via NSParagraphStyle.
|
||||
/// ponytail: quote rides body spacing — attributes(for:) styles quotes
|
||||
/// as body anyway; dedicated quote spacing waits for #20's polish pass.
|
||||
static func paragraph(_ kind: LineKind) -> NSParagraphStyle {
|
||||
static func paragraph(_: LineKind) -> NSParagraphStyle {
|
||||
let style = NSMutableParagraphStyle()
|
||||
// Edit mode shows blank source lines — the blank line IS the
|
||||
// separator. Only line height rides the flow knobs here; the
|
||||
// paragraph/heading spacing knobs are reading-mode only.
|
||||
style.lineHeightMultiple = ProseTypography.lineHeightMultiple
|
||||
let line = ProseTypography.linePoints
|
||||
switch kind {
|
||||
case .heading1: style.paragraphSpacing = 2 * line; style.paragraphSpacingBefore = 26
|
||||
case .heading2: style.paragraphSpacing = 2 * line; style.paragraphSpacingBefore = 1 * line
|
||||
case .quote, .syntaxOnly, .body: style.paragraphSpacing = 1 * line
|
||||
}
|
||||
style.paragraphSpacing = 0
|
||||
style.paragraphSpacingBefore = 0
|
||||
return style
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user