Skip to content

Conversation

@yorukot
Copy link
Owner

@yorukot yorukot commented Sep 13, 2025

No description provided.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 13, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/inline-image-protocol

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

codescene-delta-analysis[bot]

This comment was marked as outdated.

Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gates Failed
Enforce critical code health rules (1 file with Bumpy Road Ahead)

Gates Passed
2 Quality Gates Passed

See analysis details in CodeScene

Reason for failure
Enforce critical code health rules Violations Code Health Impact
image_preview.go 1 critical rule 9.10 → 8.85 Suppress

Quality Gate Profile: The Bare Minimum
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.

// ImagePreview generates a preview of an image file
func (p *ImagePreviewer) ImagePreview(path string, maxWidth int, maxHeight int,
defaultBGColor string, sideAreaWidth int) (string, error) {
defaultBGColor string, sideAreaWidth int) (string, error, ImageRenderer) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ New issue: Bumpy Road Ahead
ImagePreview has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function

Suppress

Comment on lines +378 to +396
func (p *ImagePreviewer) ClearAllImages() string {
var result strings.Builder

// Clear Kitty protocol images if supported
if p.IsKittyCapable() {
if clearCmd := p.ClearKittyImages(); clearCmd != "" {
result.WriteString(clearCmd)
}
}

// Clear inline protocol images if supported
if p.IsInlineCapable() {
if clearCmd := p.ClearInlineImage(); clearCmd != "" {
result.WriteString(clearCmd)
}
}

return result.String()
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ New issue: Bumpy Road Ahead
ClearAllImages has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function

Suppress

return "" // No need to clear if terminal doesn't support inline protocol
}

return strings.Repeat(" ", 9999)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's precompute this. Store it in a predefined variable InlineImageCleanupString or something. Will save a bit of processing, and will make code more readable.

@yorukot
Copy link
Owner Author

yorukot commented Sep 14, 2025

The current issue is that the inline image protocol doesn’t seem to support removing images, so we need to handle this through bubbletea instead. However, during this process, I found that bubbletea recognizes an image as a single line of text, which prevents the subsequent content from being re-rendered. So I used this workaround to handle the issue, but it’s admittedly a bit of a hack. I’m still considering whether there’s a cleaner solution, or if it might be better to simply force bubbletea to re-render.

@lazysegtree
Copy link
Collaborator

I see. I will try to take a stab at the issue if possible.

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.

3 participants