help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: New balance-windows (Was Re: Making the width of three windows equal


From: Ehud Karni
Subject: Re: New balance-windows (Was Re: Making the width of three windows equal)
Date: Mon, 8 Aug 2005 12:27:06 +0300

On Sun, 07 Aug 2005 13:15:35 -0400, Richard M. Stallman <rms@gnu.org> wrote:
>
> Why do you think this is better than the current balance-windows function?

Two reasons: 1. because it fails in a complex windows arrangement.
  2. I added balancing horizontally option (by prefix argument).

Here are some examples of balancing complex windows configuration
(the number in each window is the of lines in the window):

    After `balance-windows'           After my new function
    +-------+-------+-------+        +-------+-------+-------+
    |  9    |       |       |        |       |       |       |
    |       |       |  19   |        |  15   |       |  20   |
    +-------+       |       |        |       |       |       |
    |       |  29   |       |        +-------+  30   |       |
    |  19   |       +-------+        |       |       +-------+
    |       |       |       |        |  15   |       |       |
    |       |       |       |        |       |       |       |
    +----+--+-------+  19   |        +----+--+-------+  20   |
    |    |  |       |       |        |    |  |       |       |
    | 19 |  |       |       |        | 14 |  |       |       |
    |    |  |       +-------+        |    |  |       +-------+
    |    |  |  32   |       |        +----+--+  31   |       |
    +----+--+       |       |        |       |       |       |
    |       |       |  22   |        | 15    |       |  20   |
    | 12    |       |       |        |       |       |       |
    |       |       |       |        |       |       |       |
    +-------+-------+-------+        +-------+-------+-------+

In the above case mine is better.


    After `balance-windows'           After my new function
    +-----------+-----------+        +----------+------------+
    |           |   10      |        |          |     6      |
    |           |           |        |          +------------+
    |           +-----------+        |    19    |     6      |
    |   32      |   10      |        |          +------------+
    |           |           |        |          |     5      |
    |           +-----------+        +------+---+---+--------|
    |           |   10      |        |      |       |        |
    |           |           |        |  18  |       |  18    |
    +------+----+---+-------+        |      |       |        |
    |  10  |        |  10   |        |      |       |        |
    |      |        |       |        +------+-------+--------|
    +------+--------+-------+        |                       |
    |                       |        |         17            |
    |          12           |        |                       |
    |                       |        |                       |
    +-----------------------+        +-----------------------+

In this case the 22.0.50 balance-windows is better.


If 2 more splits are done, both functions fails:

    After `balance-windows'           After my new function
    +-----------+-----------+        +-----------+-----------+
    |           |    8      |        |           |   10      |
    |   17      |           |        |   14      |           |
    |           +-----------+        |           +-----------+
    |           |           |        +-----------+   10      |
    +-----------+           |        |           |           |
    |           |   17      |        |           +-----+-----+
    |   14      |           |        |   17      |     |     |
    |           +-----+-----+        |           | 10  | 10  |
    |           |  4  | 4   |        |           |     |     |
--> +------+----+---+-+-----+  -V-   +------+----+---+-+-----+ <---
    |   8  |        |  8    |        |      |        |       |
    |      |        |       |        |  12  |  12    |  12   |
    +------+--------+-------+        |      |        |       |
    |                       |        +------+--------+-------+
    |          14           |        |          10           |
    |                       |        |                       |
    +-----------------------+        +-----------------------+

The reason to the failure is that in this configuration the
vertical border (-V-) , although full length border, can NOT
be moved by resizing of any window.

I have looked into `enlarge-window' and I it is too complex for
me to fix it.

So, I'll work on my function some more. My proposed logic (for
vertical balancing) is to group the windows according to the
right edge AND the left edge (every window will be in 2 groups)
sort the groups by number of windows in each group, compute the
new size for this group and resize the windows in this group.
Now, repeat the whole process but ignore all the windows that
have already been resized. This approach is using ONLY the
geometry of the windows configuration. It sure will fail when
there is an unmovable edge.

Ehud.


--
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D <http://www.keyserver.net/>    Better Safe Than Sorry




reply via email to

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