Fix markdown rendering offset bug in toast messages#1968
Conversation
Use ANSI-aware trimLeftSpaces() instead of strings.TrimLeft() to properly handle leading spaces in Glamour-rendered output where spaces are wrapped in ANSI escape codes. Fixes inconsistent bullet point indentation in multi-line toast messages with color enabled. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
📝 WalkthroughWalkthroughAdds ANSI-aware leading-space trimming to UI markdown rendering and updates the provisioner backend API to return provisioning warnings (ProvisionResult). Tests and call sites adjusted to propagate and display warnings after UI spinner completes. Changes
Sequence Diagram(s)sequenceDiagram
participant CLI
participant Spinner
participant BackendCreate as Backend.CreateFunc
participant UI
CLI->>Spinner: start spinner "Provisioning..."
Spinner->>BackendCreate: invoke create(ctx, config, auth)
BackendCreate-->>Spinner: (*ProvisionResult{Warnings}, error)
Spinner->>CLI: stop spinner
alt error returned
CLI->>UI: show error
else success
CLI->>UI: for each warning in ProvisionResult.Warnings -> ui.Warning(w)
CLI->>UI: show success
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (8)
🧰 Additional context used📓 Path-based instructions (3)**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/{pkg,internal,cmd}/**/*.go📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*_test.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
🧠 Learnings (23)📓 Common learnings📚 Learning: 2025-09-13T18:06:07.674ZApplied to files:
📚 Learning: 2025-07-05T20:59:02.914ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-12-21T04:10:29.030ZApplied to files:
📚 Learning: 2025-11-09T19:06:58.470ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-05-30T03:21:37.197ZApplied to files:
📚 Learning: 2024-12-11T18:40:12.808ZApplied to files:
📚 Learning: 2024-10-23T21:36:40.262ZApplied to files:
📚 Learning: 2025-11-30T04:16:24.155ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-11-10T23:23:39.771ZApplied to files:
📚 Learning: 2025-11-11T03:47:59.576ZApplied to files:
📚 Learning: 2025-11-11T03:47:45.878ZApplied to files:
📚 Learning: 2025-11-08T19:56:18.660ZApplied to files:
📚 Learning: 2025-12-13T04:37:25.223ZApplied to files:
📚 Learning: 2025-08-16T23:32:40.412ZApplied to files:
📚 Learning: 2025-01-16T11:41:35.531ZApplied to files:
📚 Learning: 2025-08-16T23:33:07.477ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-09-10T21:17:55.273ZApplied to files:
🧬 Code graph analysis (6)pkg/provisioner/provisioner.go (3)
pkg/provisioner/backend/backend_test.go (1)
pkg/provisioner/backend_hook.go (3)
pkg/provisioner/backend/s3_e2e_test.go (1)
pkg/provisioner/backend/backend.go (3)
pkg/provisioner/provisioner_test.go (2)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (30)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1968 +/- ##
==========================================
- Coverage 74.51% 74.51% -0.01%
==========================================
Files 777 777
Lines 71003 71044 +41
==========================================
+ Hits 52910 52939 +29
- Misses 14626 14642 +16
+ Partials 3467 3463 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…nt output - Add ProvisionResult type to collect warnings from backend provisioning - Update BackendCreateFunc to return (*ProvisionResult, error) - Update applyS3BucketDefaults to return warnings instead of printing directly - Display warnings AFTER spinner completes to avoid text corruption - Add tests verifying warning collection for existing buckets This fixes the concurrent output issue where ui.Warning() was called inside the spinner callback, causing text interleaving and display corruption (e.g., bucket name + component name merged together). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
These changes were released in v1.204.0. |
what
trimLeftSpaces()function to properly handle leading space trimming when Glamour wraps spaces in ANSI escape codestoastMarkdown()andrenderInlineMarkdownWithBase()to use ANSI-aware trimmingwhy
Glamour wraps spaces in ANSI codes when color is enabled. The previous code used
strings.TrimLeft()which isn't ANSI-aware and failed to remove leading spaces, causing inconsistent indentation in multi-line markdown output.references
Fixes: Markdown rendering with inconsistent bullet list indentation in terminal UI messages
Summary by CodeRabbit
Bug Fixes
User Experience
Tests
✏️ Tip: You can customize this high-level summary in your review settings.