emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prefer to split along the longest edge


From: Juri Linkov
Subject: Re: Prefer to split along the longest edge
Date: Mon, 16 Dec 2024 09:55:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu)

>> Maybe increasing the value of split-height-threshold will help you?
>> For example, I customized it to a large value, so I have no problems
>> because then windows are split only horizontally.
>
> Yes, but I do want it to split vertically at some point.
> Typically, in fullscreen mode, after 3 or 4 horizontal splits, I want it to
> split vertically.

Makes sense.  Then what about adding a new option that defines
the minimal number of columns each window should have after split?
With a name like 'split-columns-threshold'.

As long as the width of a new window will fit into 'split-columns-threshold',
split horizontally, otherwise vertically.

Then you can split to 3 or 4 horizontal splits until reaching the limit
of 'split-columns-threshold'.  After that should split the narrow windows
vertically.

>>> But I understand the bias toward vertical splitting, that's why I added a
>>> condition to prioritize vertical split if the width is less than 80.
>>> This heuristic could be improved, thought. 
>>
>> I don't see the bias toward vertical splitting.
>>
>> Vertical split will be preferred even if you have a large width and a very
>> narrow height as long as it is higher than the threshold.

Agreed, this is a problem.

>> But if you could write in a clear form the current rules for an overview
>> and what changes do you propose, then the heuristic could be improved.
>> For example, how these rules could look:
>>
>> 1. split vertically if the width is less than 80
>> 2. split horizontally if split-width-threshold is more than 160
>> 3. split vertically otherwise
>
> The patch I attached does this:
>
> if width > height and width > 80
>    try to split horizontally, then try vertically and finally fallback to 
> horizontal split
> else
>    try to split vertically, then try horizontally and finally fallback to 
> vertical split

We need to carefully check if it can handle various use cases.

> I have been using it for a couple of weeks and it is working fine.
> The condition could be tweaked, specially the (widht > 80) part. We could
> also decide to always fallback to vertical split at the end (which will fix
> my implementation problem).

Indeed, better to fallback to vertical split when all options are exhausted.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]