diff --git a/KisaniCal/Views/TodayView.swift b/KisaniCal/Views/TodayView.swift index 83a5970..d5b402d 100644 --- a/KisaniCal/Views/TodayView.swift +++ b/KisaniCal/Views/TodayView.swift @@ -1778,18 +1778,18 @@ struct NLTaskField: UIViewRepresentable { } return } - // Avoid clobbering the live UITextView (and the cursor) when the displayed - // text already matches the binding. - if tv.textColor == .label && tv.text == text && editing { return } - + // Always rebuild the attributed text so token highlights stay live as the + // parser updates highlightRanges on each keystroke. (A fast-path early-return + // here previously suppressed highlighting while editing.) let sel = tv.selectedRange let attr = NSMutableAttributedString(string: text) let full = NSRange(location: 0, length: attr.length) attr.addAttributes([.font: UIFont.systemFont(ofSize: 18), .foregroundColor: UIColor.label], range: full) + let highlight = UIColor(AppColors.accent) for r in highlightRanges where r.location + r.length <= attr.length { attr.addAttributes([ - .backgroundColor: UIColor.systemBlue.withAlphaComponent(0.13), - .foregroundColor: UIColor.systemBlue, + .backgroundColor: highlight.withAlphaComponent(0.18), + .foregroundColor: highlight, ], range: r) } tv.attributedText = attr