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

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

bug#12419: Mouse click changes layout


From: martin rudalics
Subject: bug#12419: Mouse click changes layout
Date: Sat, 15 Sep 2012 16:34:31 +0200

> But why did you say that your proposed change in window.el doesn't
> restore the Emacs 23 behavior?  AFAICS, it does: if I set
> max-mini-window-height to a large number, like 100, Emacs 23 also
> resizes windows other than the lowest one.

My algorithm growing the minibuffer window emulates Gerd's.  But there
is no algorithm for shrinking the minibuffer window because no reliable
one exists.  Gerd stores all original window heights before growing the
minibuffer window and emulates shrinking to the original line by writing
them back into the height fields of the window structure.  This requires
some care and can fail, for example, when resizing the frame with an
enlarged minibuffer.  And IIUC this is also the reason for the somewhat
strange default value `grow-only' for `resize-mini-windows'.

Look at Gerd's shrinking routine below:

shrink_mini_window (w)
     struct window *w;
{
  struct frame *f = XFRAME (w->frame);
  struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));

  if (save_restore_orig_size (root, CHECK_ORIG_SIZES))

----> This is taken if heights were stored earlier and the size check
      suceeds.  Note that it just restores the original sizes, there's
      no shrinking from say 3 to 2 lines.

    {
      save_restore_orig_size (root, RESTORE_ORIG_SIZES);
      adjust_glyphs (f);
      FRAME_WINDOW_SIZES_CHANGED (f) = 1;
      windows_or_buffers_changed = 1;
    }
  else if (XFASTINT (w->total_lines) > 1)

----> This is the branch taken in the `resize-mini-windows' t case or
      when the size check above fails.  It does the old enlarge_window
      routine which can shed bad results and in some cases even delete
      the windows it's supposed to enlarge.  This could also shrink a
      minibuffer from 3 to 2 lines; but that feature is not used, likely
      because Gerd trusted that nobody would want it.  So, by force, the
      minibuffer window always shrinks back to one line.

    {
      /* Distribute the additional lines of the mini-window
         among the other windows.  */
      Lisp_Object window;
      XSETWINDOW (window, w);
      enlarge_window (window, 1 - XFASTINT (w->total_lines), 0);
    }
}

martin





reply via email to

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