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

max_width / max_heigth only affects image preview but not pdf preview #1197

Closed
Mirkopoj opened this issue Jun 24, 2024 · 18 comments · Fixed by #1200
Closed

max_width / max_heigth only affects image preview but not pdf preview #1197

Mirkopoj opened this issue Jun 24, 2024 · 18 comments · Fixed by #1200
Labels
bug Something isn't working

Comments

@Mirkopoj
Copy link

What system are you running Yazi on?

Linux X11

What terminal are you running Yazi in?

Alacritty

Did you try the latest code to see if this problem got fixed?

Tried, but the problem still

yazi --debug output

Yazi
    Version: 0.2.5 (Arch Linux 2024-06-23)
    Debug  : false
    OS     : linux-x86_64 (unix)

Ya
    Version: 0.2.5

Emulator
    Emulator.via_env: ("alacritty", "")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect : Unknown([])

Adapter
    Adapter.matches: X11

Desktop
    XDG_SESSION_TYPE: Some("tty")
    WAYLAND_DISPLAY : None
    DISPLAY         : Some(":0")

SSH
    shared.in_ssh_connection: false

WSL
    /proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
    SHELL              : Some("/usr/bin/fish")
    EDITOR             : Some("nvim")
    ZELLIJ_SESSION_NAME: None
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None

Text Opener
    default: Some(Opener { run: "${EDITOR:=vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block  : Some(Opener { run: "${EDITOR:=vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

tmux
    TMUX   : false
    Version: 3.4

Dependencies
    file             : 5.45
    ueberzugpp       : 2.9.6
    ffmpegthumbnailer: 2.2.2
    magick           : 7.1.1-33
    fzf              : 0.53.0
    fd               : 10.1.0
    rg               : 14.1.0
    chafa            : 1.14.1
    zoxide           : 0.9.4
    unar             : 1.10.7
    jq               : 1.7.1

Describe the bug

I have 1 pdf file that breaks Ueberzug++ when max_width > 200, but for it to fit properly in yazi it needs have max_width = 95.
So I edited mi yazi.toml and set max_width = 200, ran yazi --clear-cache and the error persited. After checking the Ueberzug log I found that the command was still using max_width = 330. I kept reducing max_width with no luck until I max_width =2 with no effect, then I realized that images where scalled down, but pdf preview wasn't. Using ueberzug scale fixes the issue, but I need to set a global 0.6 scalling when most content looked perfect before.

Expected Behavior

I would expect max_width to limit all previewed content's width, not just images.

To Reproduce

I guess the best I can do is to send the pdf that causes the problem.

Beginner's Guide To 3D Art Assets - Buildings.pdf

Configuration

no config

Anything else?

The pdf I attached is the main problem because it brakes Ueberzug, wich I understand isn't a concern here.
But almost all pdfs are out of scale and look wrong on preview and the only solution that works is global scaling.

It would be nice to be able to set the maximum width so that it would make all previews fit the preview panel.

@Mirkopoj Mirkopoj added the bug Something isn't working label Jun 24, 2024
@sxyazi
Copy link
Owner

sxyazi commented Jun 24, 2024

Please follow https://yazi-rs.github.io/docs/image-preview#debug-ueberzug to upload these logs

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Jun 24, 2024
@Mirkopoj
Copy link
Author

yazi log

  2024-06-24T01:08:56.967402Z  WARN yazi_adapter::emulator: [Adapter] No special environment variables detected
    at yazi-adapter/src/emulator.rs:70

  2024-06-24T01:08:56.967429Z  WARN yazi_adapter::emulator: [Adapter] Unknown TERM_PROGRAM: 
    at yazi-adapter/src/emulator.rs:84

  2024-06-24T01:08:56.967431Z  WARN yazi_adapter::emulator: [Adapter] Unknown TERM: alacritty
    at yazi-adapter/src/emulator.rs:92

  2024-06-24T01:08:56.967658Z  WARN yazi_adapter::adapter: [Adapter] Could not identify XDG_SESSION_TYPE
    at yazi-adapter/src/adapter.rs:101

  2024-06-24T01:08:57.049105Z ERROR yazi_scheduler::preload::prework: Preload task `image` returned 2
    at yazi-scheduler/src/preload/prework.rs:62

  2024-06-24T01:08:57.049409Z ERROR yazi_scheduler::preload::prework: Preload task `image` returned 2
    at yazi-scheduler/src/preload/prework.rs:62

  2024-06-24T01:08:57.052734Z ERROR yazi_scheduler::preload::prework: Preload task `magick` returned 2
    at yazi-scheduler/src/preload/prework.rs:62

Ueberzug++ log

 _   _      _
| | | |    | |                                _     _
| | | | ___| |__   ___ _ __ _____   _  __ _ _| |_ _| |_
| | | |/ _ \ '_ \ / _ \ '__|_  / | | |/ _` |_   _|_   _|
| |_| |  __/ |_) |  __/ |   / /| |_| | (_| | |_|   |_|
 \___/ \___|_.__/ \___|_|  /___|\__,_|\__, |
                                       __/ |
                                      |___/     v2.9.6
[2024-06-23 22:08:57.037] [terminal] [info] TERM = alacritty
[2024-06-23 22:08:57.038] [terminal] [info] PTY = /dev/pts/1
[2024-06-23 22:08:57.038] [X11] [info] Canvas created
[2024-06-23 22:08:57.038] [main] [info] Listening for commands on socket /tmp/ueberzugpp-475661.socket
[2024-06-23 22:08:57.073] [main] [info] Command received: {"action":"add","identifier":"yazi","max_height":158,"max_width":330,"path":"/tmp/yazi/c88082833bbe31760b746a683471b9e8","x":160,"y":1}
[2024-06-23 22:08:57.103] [opencv] [info] loading file /tmp/yazi/c88082833bbe31760b746a683471b9e8
[2024-06-23 22:08:58.440] [main] [info] Exiting ueberzugpp

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label Jun 24, 2024
@Mirkopoj
Copy link
Author

Those are fresh logs with no config, opening yazi right on the pdf that caused the problem. As you can see max_width is send as 330. That same command breaks Ueberzug (A Black frame is render that wont leave until the process is stoped), but changing max_width to 200 fixes it. The problem is that changing the max_width in yazi.toml only affects images, not pdf preview. So the only way I have to shrink the preview to fix it is to change Ueberzug scale.

@sxyazi
Copy link
Owner

sxyazi commented Jun 24, 2024

I don't see any Ueberzug commands in yazi.log. Are you in debug mode?

@sxyazi
Copy link
Owner

sxyazi commented Jun 24, 2024

And also upload a gif of the steps of https://yazi-rs.github.io/docs/image-preview#debug-ueberzug and your /tmp/yazi/c88082833bbe31760b746a683471b9e8 file

@Mirkopoj
Copy link
Author

Oh, I'm sorry I'll re try in debug mode.
But I don't understand what do you mean by "GIF demonstration of the above steps". Is it a srceenshot of ueberzug properlly showing the preview when launched with the expected command?

@sxyazi
Copy link
Owner

sxyazi commented Jun 24, 2024

Yep, I want to see your terminal size and the relative position of ueberzug

@Mirkopoj
Copy link
Author

@Mirkopoj
Copy link
Author

max_width 200 makes Ueberzug not crash but it still looks wrong.
/tmp/yazi/c88082833bbe31760b746a683471b9e8 is ziped because github won't allow it.

@sxyazi
Copy link
Owner

sxyazi commented Jun 24, 2024

Run tput cols and tput lines

Paste the output here

@Mirkopoj
Copy link
Author

yazi log

  �[2m2024-06-24T01:37:18.970112Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] No special environment variables detected�[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:70

  �[2m2024-06-24T01:37:18.970178Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] Unknown TERM_PROGRAM: �[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:84

  �[2m2024-06-24T01:37:18.970190Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] Unknown TERM: alacritty�[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:92

  �[2m2024-06-24T01:37:18.970503Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::adapter�[0m�[33m: �[33m[Adapter] Could not identify XDG_SESSION_TYPE�[0m
    �[2;3mat�[0m yazi-adapter/src/adapter.rs:101

  �[2m2024-06-24T01:37:19.039314Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp rect before adjustment: Rect { x: 160, y: 1, width: 330, height: 158 }�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:99

  �[2m2024-06-24T01:37:19.039411Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp rect after adjustment: Rect { x: 160, y: 1, width: 330, height: 158 }�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:101

  �[2m2024-06-24T01:37:19.039457Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp command: {"action":"add","identifier":"yazi","x":160,"y":1,"max_width":330,"max_height":158,"path":"/tmp/yazi/c88082833bbe31760b746a683471b9e8"}
�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:112

  �[2m2024-06-24T01:37:19.131967Z�[0m �[31mERROR�[0m �[1;31myazi_scheduler::preload::prework�[0m�[31m: �[31mPreload task `image` returned 2�[0m
    �[2;3mat�[0m yazi-scheduler/src/preload/prework.rs:62

  �[2m2024-06-24T01:37:19.132269Z�[0m �[31mERROR�[0m �[1;31myazi_scheduler::preload::prework�[0m�[31m: �[31mPreload task `image` returned 2�[0m
    �[2;3mat�[0m yazi-scheduler/src/preload/prework.rs:62

  �[2m2024-06-24T01:37:19.144645Z�[0m �[31mERROR�[0m �[1;31myazi_scheduler::preload::prework�[0m�[31m: �[31mPreload task `magick` returned 2�[0m
    �[2;3mat�[0m yazi-scheduler/src/preload/prework.rs:62

Ueberzug++ log

 _   _      _
| | | |    | |                                _     _
| | | | ___| |__   ___ _ __ _____   _  __ _ _| |_ _| |_
| | | |/ _ \ '_ \ / _ \ '__|_  / | | |/ _` |_   _|_   _|
| |_| |  __/ |_) |  __/ |   / /| |_| | (_| | |_|   |_|
 \___/ \___|_.__/ \___|_|  /___|\__,_|\__, |
                                       __/ |
                                      |___/     v2.9.6
[2024-06-23 22:37:19.037] [terminal] [info] TERM = alacritty
[2024-06-23 22:37:19.038] [terminal] [info] PTY = /dev/pts/1
[2024-06-23 22:37:19.038] [terminal] [debug] ioctl sizes: COLS=254 ROWS=66 XPIXEL=2540 YPIXEL=1386
[2024-06-23 22:37:19.038] [terminal] [debug] iterm2 is not supported
[2024-06-23 22:37:19.038] [terminal] [debug] X11 is supported
[2024-06-23 22:37:19.038] [terminal] [debug] Using fallback X11 window id 12582915
[2024-06-23 22:37:19.038] [terminal] [debug] X11 sizes: XPIXEL=2544 YPIXEL=1400
[2024-06-23 22:37:19.038] [terminal] [debug] padding_horiz=2 padding_vert=7
[2024-06-23 22:37:19.038] [terminal] [debug] font_width=10 font_height=21
[2024-06-23 22:37:19.038] [main] [debug] Wayland support not compiled in the binary
[2024-06-23 22:37:19.038] [X11] [info] Canvas created
[2024-06-23 22:37:19.038] [main] [info] Listening for commands on socket /tmp/ueberzugpp-506043.socket
[2024-06-23 22:37:19.073] [main] [info] Command received: {"action":"add","identifier":"yazi","max_height":158,"max_width":330,"path":"/tmp/yazi/c88082833bbe31760b746a683471b9e8","x":160,"y":1}
[2024-06-23 22:37:19.106] [opencv] [info] loading file /tmp/yazi/c88082833bbe31760b746a683471b9e8
[2024-06-23 22:37:19.145] [X11] [debug] Initializing canvas
[2024-06-23 22:37:19.145] [X11] [debug] Created child window 48234496 at (1602,28) with parent 12582915
[2024-06-23 22:37:19.146] [X11] [debug] Received expose event for window 48234496
[2024-06-23 22:37:21.245] [main] [info] Exiting ueberzugpp

@Mirkopoj
Copy link
Author

yazi.log with max_width = 200

  �[2m2024-06-24T01:42:20.542716Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] No special environment variables detected�[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:70

  �[2m2024-06-24T01:42:20.542778Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] Unknown TERM_PROGRAM: �[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:84

  �[2m2024-06-24T01:42:20.542790Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::emulator�[0m�[33m: �[33m[Adapter] Unknown TERM: alacritty�[0m
    �[2;3mat�[0m yazi-adapter/src/emulator.rs:92

  �[2m2024-06-24T01:42:20.543167Z�[0m �[33m WARN�[0m �[1;33myazi_adapter::adapter�[0m�[33m: �[33m[Adapter] Could not identify XDG_SESSION_TYPE�[0m
    �[2;3mat�[0m yazi-adapter/src/adapter.rs:101

  �[2m2024-06-24T01:42:20.611086Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp rect before adjustment: Rect { x: 160, y: 1, width: 330, height: 158 }�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:99

  �[2m2024-06-24T01:42:20.611206Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp rect after adjustment: Rect { x: 160, y: 1, width: 330, height: 158 }�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:101

  �[2m2024-06-24T01:42:20.611237Z�[0m �[34mDEBUG�[0m �[1;34myazi_adapter::ueberzug�[0m�[34m: �[34mueberzugpp command: {"action":"add","identifier":"yazi","x":160,"y":1,"max_width":330,"max_height":158,"path":"/tmp/yazi/c88082833bbe31760b746a683471b9e8"}
�[0m
    �[2;3mat�[0m yazi-adapter/src/ueberzug.rs:112

  �[2m2024-06-24T01:42:20.717324Z�[0m �[31mERROR�[0m �[1;31myazi_scheduler::preload::prework�[0m�[31m: �[31mPreload task `image` returned 2�[0m
    �[2;3mat�[0m yazi-scheduler/src/preload/prework.rs:62

  �[2m2024-06-24T01:42:20.718068Z�[0m �[31mERROR�[0m �[1;31myazi_scheduler::preload::prework�[0m�[31m: �[31mPreload task `image` returned 2�[0m
    �[2;3mat�[0m yazi-scheduler/src/preload/prework.rs:62

  �[2m2024-06-24T01:42:20.726162Z�[0m �[31mERROR�[0m �[1;31myazi_scheduler::preload::prework�[0m�[31m: �[31mPreload task `magick` returned 2�[0m
    �[2;3mat�[0m yazi-scheduler/src/preload/prework.rs:62

ueberzug.log

 _   _      _
| | | |    | |                                _     _
| | | | ___| |__   ___ _ __ _____   _  __ _ _| |_ _| |_
| | | |/ _ \ '_ \ / _ \ '__|_  / | | |/ _` |_   _|_   _|
| |_| |  __/ |_) |  __/ |   / /| |_| | (_| | |_|   |_|
 \___/ \___|_.__/ \___|_|  /___|\__,_|\__, |
                                       __/ |
                                      |___/     v2.9.6
[2024-06-23 22:42:20.610] [terminal] [info] TERM = alacritty
[2024-06-23 22:42:20.610] [terminal] [info] PTY = /dev/pts/1
[2024-06-23 22:42:20.610] [terminal] [debug] ioctl sizes: COLS=254 ROWS=66 XPIXEL=2540 YPIXEL=1386
[2024-06-23 22:42:20.610] [terminal] [debug] iterm2 is not supported
[2024-06-23 22:42:20.610] [terminal] [debug] X11 is supported
[2024-06-23 22:42:20.610] [terminal] [debug] Using fallback X11 window id 12582915
[2024-06-23 22:42:20.610] [terminal] [debug] X11 sizes: XPIXEL=2544 YPIXEL=1400
[2024-06-23 22:42:20.611] [terminal] [debug] padding_horiz=2 padding_vert=7
[2024-06-23 22:42:20.611] [terminal] [debug] font_width=10 font_height=21
[2024-06-23 22:42:20.611] [main] [debug] Wayland support not compiled in the binary
[2024-06-23 22:42:20.611] [X11] [info] Canvas created
[2024-06-23 22:42:20.611] [main] [info] Listening for commands on socket /tmp/ueberzugpp-509715.socket
[2024-06-23 22:42:20.641] [main] [info] Command received: {"action":"add","identifier":"yazi","max_height":158,"max_width":330,"path":"/tmp/yazi/c88082833bbe31760b746a683471b9e8","x":160,"y":1}
[2024-06-23 22:42:20.672] [opencv] [info] loading file /tmp/yazi/c88082833bbe31760b746a683471b9e8
[2024-06-23 22:42:20.707] [X11] [debug] Initializing canvas
[2024-06-23 22:42:20.707] [X11] [debug] Created child window 56623104 at (1602,28) with parent 12582915
[2024-06-23 22:42:20.708] [X11] [debug] Received expose event for window 56623104
[2024-06-23 22:42:21.712] [main] [info] Exiting ueberzugpp

@Mirkopoj
Copy link
Author

tput cols => 254
tput lines => 66

@sxyazi
Copy link
Owner

sxyazi commented Jun 24, 2024

Thanks for the info, I'll make a patch later to try and fix it

@Mirkopoj
Copy link
Author

Mirkopoj commented Jun 24, 2024

Ok, great. Thanks for the impressively fast responses.
And great work with yazi!!

@sxyazi
Copy link
Owner

sxyazi commented Jun 24, 2024

Should be fixed in #1200, please give it a try to see if it works for you!

@Mirkopoj
Copy link
Author

Yes, it is fixed. Thanks for the help.

Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳
This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants