Skip to content

Commit

Permalink
docs: improve image preview documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Mar 14, 2024
1 parent 8379cc7 commit 836b8a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/configuration/yazi.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ Tab width.

Maximum preview width for images. Do a `yazi --clear-cache` to take effect after changing this.

This value is also used for preloading images; the larger it is, the larger the image cache generated, which consumes more CPU.

### `max_height`

Maximum preview height for images. Do a `yazi --clear-cache` to take effect after changing this.

This value is also used for preloading images; the larger it is, the larger the image cache generated, which consumes more CPU.

### `cache_dir`

The system cache directory is used by default, and the cached files will go away on a reboot automatically.
Expand Down
11 changes: 9 additions & 2 deletions docs/image-preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ If the image shows properly when using Überzug++ independently, but not when us

## Why won't my images adapt to terminal size?

Some terminals (such as VSCode, Tabby, and all Windows terminals) do not implement the `ioctl` system call, before [Add `CSI 14 t` sequence support](https://github.com/crossterm-rs/crossterm/pull/810) is merged, it is not possible to obtain the actual pixel width and height of the terminal.
The size of the image depends on two factors:

Therefore, Yazi uses `preview.max_width` and `preview.max_height` as the image size, which is specified by the user in `yazi.toml`.
1. the user's settings for [max_width](/docs/configuration/yazi#max_width) and [max_height](/docs/configuration/yazi#max_height);
2. the pixel size of the terminal.

Yazi will use the smaller of these two values as the image preview size.

However, some terminals (such as VSCode, Tabby, and all Windows terminals) don't implement the `ioctl` system call, before [Add `CSI 14 t` sequence support](https://github.com/crossterm-rs/crossterm/pull/810) is merged, it's not possible to obtain the actual pixel width and height of the terminal.

Hence, only `max_width` and `max_height` will be used in this case.

0 comments on commit 836b8a5

Please sign in to comment.