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

Smarter automatic split for --location=split in splits layout #6867

Closed
dhanak opened this issue Nov 29, 2023 · 5 comments
Closed

Smarter automatic split for --location=split in splits layout #6867

dhanak opened this issue Nov 29, 2023 · 5 comments

Comments

@dhanak
Copy link

dhanak commented Nov 29, 2023

Is your feature request related to a problem? Please describe.

When using the splits layout, --location=split automatically decides when to split vertically and when to split horizontally. With the font I use, this automatism tends to select a vertical split even when my window is visually vertical, so a horizontal split would be more ideal.

Describe the solution you'd like

The automatic decision should take the font shape into account, and apply a with/height ratio threshold based on visual layout, i.e., number of pixels, rather than the raw number of cells (as I assume it works now).

Describe alternatives you've considered

There could be an option to control the threshold ratio of the window, i.e., split vertically if width/height > 3 (where 3 is configurable), otherwise horizontally.

Additional context

kitty 0.30.0 (ef8e3b1) created by Kovid Goyal
Linux ci0156 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64
Debian GNU/Linux 12 ci0156 /dev/tty

@kovidgoyal
Copy link
Owner

The visual space is not relevant, the actual useable space
is the number of cells, unless you are displaying images.
Since displaying images is not the common case, the correct metric to
use is the number of cells not the number of pixels. In other words a
wide window is one where the number of text characters you can display
in a line is more than the number of lines of text you can display and
vice versa.

@dhanak
Copy link
Author

dhanak commented Nov 29, 2023

I guess this is a matter of personal taste. The visual space is relevant to visually please the viewer, i.e., me. I for one, don't like the look of long vertical windows, and I also prefer having my terminals much wider than tall. (I don't like wrapped lines, but I don't mind seeing only a few lines at a time.)

Currently, I have 122x48 cells, which get split vertically first, but I'd prefer splitting it horizontally first, and vertically second. It wouldn't hurt to have a configuration option for this "golden ratio", would it?

@kovidgoyal
Copy link
Owner

kovidgoyal commented Nov 29, 2023 via email

@dhanak
Copy link
Author

dhanak commented Nov 29, 2023

Sure, that's what I do now. But then I need two separate keybindings, have to remember which is which, and pay attention to which one I press. Not a big deal, I know. But it would be so much more convenient to use a single key for all that. And what is the point of a smart split feature, if it doesn't do what you consider smart?

But I get it, you don't want to work on this. And of course you have every right to do so.

@kovidgoyal
Copy link
Owner

You are welcome to write a simple custom kitten to implement whatever
behavior you consider smart.
https://sw.kovidgoyal.net/kitty/kittens/custom/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants