Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request]: Sixel Image Preview As now Fzf supports that. #749

Open
niksingh710 opened this issue Sep 26, 2024 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@niksingh710
Copy link

Problem

Why do we need this feature?
So that terminals having sixel support can easily show thumbnails.

Feature

Description of your proposed feature.

chafa -f sixel -s "''${FZF_PREVIEW_COLUMNS}x''${FZF_PREVIEW_LINES}" "$2" --animate false

This is the command i use in my fzf preview script to handle images.

@niksingh710 niksingh710 added the enhancement New feature or request label Sep 26, 2024
@Euro20179
Copy link
Collaborator

I'm very excited that fzf has added this!

8637bc3

@niksingh710
Copy link
Author

niksingh710 commented Sep 28, 2024

output

This is the issue i am facing.

The thumbnail size is slightly bigger than the size of fzf preview box.
so fzf only renders bordered box and shows the image when the preview window is scrolled.

I guess reduction of the thumbnail dimensions would be a option to fix this

@niksingh710
Copy link
Author

diff --git a/ytfzf b/ytfzf
index 3da39ac..066f56c 100755
--- a/ytfzf
+++ b/ytfzf
@@ -2983,7 +2983,7 @@ preview_display_image() {
     chafa-sixel)
         printf '\n'
         command_exists "chafa" || die 3 "${new_line}chafa is not installed"
-        chafa -f sixel -s "${FZF_PREVIEW_COLUMNS}x${FZF_PREVIEW_LINES}" "$thumb_path" 2>> "$thumbnail_debug_log" ;;
+        chafa -f sixel -s "${FZF_PREVIEW_COLUMNS}x$(( FZF_PREVIEW_LINES - 7 ))" "$thumb_path" 2>> "$thumbnail_debug_log" ;;
 	catimg)
 		printf '\n'
 		command_exists "catimg" || die 3 "${new_line}catimg is not installed"

This patch fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants