[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New balance-windows
From: |
Pascal Bourguignon |
Subject: |
Re: New balance-windows |
Date: |
Sat, 06 Aug 2005 18:39:14 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
"Ehud Karni" <ehud@unix.mvs.co.il> writes:
> Following the recent discussion of `balance-windows' on help-gnu-emacs
> I looked into it and wrote a replacement (new) function based on
> somewhat different logic to achieve the balancing.
Thanks very much. It's nice. But it's not perfect, see at the end.
> The logic is this: group all windows that has the same "left" (or "top"
> for horizontal) edge, and balance their height (width).
>
> The actual resizing is dependent on the window structure.
> e.g. the two symmetrical window structures below will be balanced
> differently (the diagrams are after vertical balancing):
>
> +-------+--------+ +-------+--------+
> | | | | | |
> | 1 / 3 | | | | 1 / 4 |
> | | | | 1 / 2 +--------+
> +-------| 2 / 3 | | | |
> | | | | | 1 / 4 |
> | 1 / 3 | | +-------+--------+
> | | | | |
> +-------+--------+ | |
> | | | 1 / 2 |
> | 1 / 3 | | |
> | | | |
> +-------+--------+ +-------+--------+
I'm not sure it's justified.
Note that:
+------+------+
| | |
| | |
+------+------+
| | |
| | |
+------+------+
may represent two different structures: C-x 2 C-x 3 C-x o C-x 3
or C-x 3 C-x 2 C-x o C-x 2
But in both these cases:
+-------+--------+ +-------+--------+
| | | | | |
| 1 / 3 | | | | 1 / 4 |
| | | | 1 / 2 +--------+
+-------| 2 / 3 | | | |
| | | | | 1 / 4 |
| 1 / 3 | | +-------+--------+
| | | | |
+-------+--------+ | |
| | | 1 / 2 |
| 1 / 3 | | |
| | | |
+-------+--------+ +-------+--------+
the hierarchy of splits is the same, so I don't see why it should
balance differently.
I think a correct algorithm should recover the split tree, then make
the balancing depending on the window counts in subtrees.
C-x 2 C-x 3 C-x 2 C-x 2 M-x balance-window RET is OK:
+-------+-------+
| | |
| | |
+-------+ |
| | |
| | |
+-------+ |
| | |
| | |
+-------+-------+
| |
| |
+---------------+
but then: C-X o C-X o C-X o C-X o C-x 2, giving:
+-------+-------+
| | |
| | |
+-------+ |
| | |
| | |
+-------+ |
| | |
| | |
+-------+-------+
| |
+---------------+
| |
+---------------+
and M-x balance-window RET doesn't balance at all:
+-------+-------+
| | |
| | |
+-------+ |
| | |
| | |
+-------+ |
| | |
| | |
+-------+-------+
+---------------+
| |
| |
+---------------+
I'd expect:
+-------+-------+
| | |
+-------+ |
| | |
+-------+ |
| | |
+-------+-------+
| |
+---------------+
| |
+---------------+
--
__Pascal Bourguignon__ http://www.informatimago.com/
The world will now reboot. don't bother saving your artefacts.
- Re: New balance-windows, (continued)
- Re: New balance-windows (Was Re: Making the width of three windows equal), Richard M. Stallman, 2005/08/07
- Re: New balance-windows (Was Re: Making the width of three windows equal), Ehud Karni, 2005/08/08
- Re: New balance-windows (Was Re: Making the width of three windows equal), Richard M. Stallman, 2005/08/08
- Re: New balance-windows, Stefan Monnier, 2005/08/09
- Re: New balance-windows, Stefan Monnier, 2005/08/09
- Message not available
- Re: New balance-windows, David Combs, 2005/08/20
- Message not available
- Re: New balance-windows, Pascal Bourguignon, 2005/08/08
- Message not available
- Re: New balance-windows, Pascal Bourguignon, 2005/08/07
- Message not available
- Re: New balance-windows,
Pascal Bourguignon <=
- Re: New balance-windows, Lennart Borgman, 2005/08/06
- Message not available
- Re: New balance-windows, Pascal Bourguignon, 2005/08/06
- Re: New balance-windows, Lennart Borgman, 2005/08/06
- Message not available
- Re: New balance-windows, Pascal Bourguignon, 2005/08/07
- Re: New balance-windows, Lennart Borgman, 2005/08/07
- Message not available
- Re: New balance-windows, Pascal Bourguignon, 2005/08/07
- Re: New balance-windows, Ehud Karni, 2005/08/06
- Re: New balance-windows, Lennart Borgman, 2005/08/06
- Re: New balance-windows, Ehud Karni, 2005/08/08
- Re: New balance-windows, Lennart Borgman, 2005/08/08