all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: martin rudalics <rudalics@gmx.at>
Cc: luangruo@yahoo.com, 70038@debbugs.gnu.org
Subject: bug#70038: 29.3.50; Shift up/down in buffer with images on M-x other-window with some fonts
Date: Sun, 14 Apr 2024 12:28:47 +0300	[thread overview]
Message-ID: <865xwknvhs.fsf@gnu.org> (raw)
In-Reply-To: <e43cd4af-da0f-4306-9fbb-02ae1e93bf7f@gmx.at> (message from martin rudalics on Sun, 14 Apr 2024 10:31:15 +0200)

> Date: Sun, 14 Apr 2024 10:31:15 +0200
> Cc: luangruo@yahoo.com, 70038@debbugs.gnu.org
> From: martin rudalics <rudalics@gmx.at>
> 
>  > The (slight) harm this does is that it might make redisplay of the
>  > window slightly more expensive, because it disables some
>  > optimizations, like if nothing changed except the position of point.
>  > Another kind of harm is what triggered this bug report: it could cause
>  > us to reset the window's vscroll for now good reason, because when
>  > start positions are frozen, we set the window's force_start flag, and
>  > that sometimes forces us to reset vscroll.
> 
>  From looking at the code it's hard to understand what you say here.  It
> might be a good idea to add this as a comment.

If the window is frozen, we do this:

  /* If someone specified a new starting point but did not insist,
     check whether it can be used.  */
  if ((w->optional_new_start || window_frozen_p (w))
      && CHARPOS (startp) >= BEGV
      && CHARPOS (startp) <= ZV)
    {
      ptrdiff_t it_charpos;

      w->optional_new_start = false;
      if (!w->force_start)
	{
	[...]
	  /* Make sure we set the force_start flag only if the cursor
	     row will be fully visible.  Otherwise, the code under
	     force_start label below will try to move point back into
	     view, which is not what the code which sets
	     optional_new_start wants.  */
	  if (it.current_y == 0 || line_bottom_y (&it) < it.last_visible_y)
	    {
	      if (it_charpos == PT)
		w->force_start = true;
	      /* IT may overshoot PT if text at PT is invisible.  */
	      else if (it_charpos > PT && CHARPOS (startp) <= PT)
		w->force_start = true;

So this sets w->force_start.  Then the code under this condition will
be executed:

  /* Handle case where place to start displaying has been specified,
     unless the specified location is outside the accessible range.  */
  if (w->force_start)

That code calls try_window, so it's more expensive than the
optimization under this condition:

 ignore_start:

  /* Handle case where text has not changed, only point, and it has
     not moved off the frame, and we are not retrying after hscroll.
     (current_matrix_up_to_date_p is true when retrying.)  */
  if (current_matrix_up_to_date_p
      && (rc = try_cursor_movement (window, startp, &temp_scroll_step),
	  rc != CURSOR_MOVEMENT_CANNOT_BE_USED))

which is what we want to do when text has not changed and point didn't
move far away.

Did I succeed explaining the issue?

>  > So the patch below is the only change we need to make sure the frame's
>  > frozen_window_starts is reset when the mini-window is resized back?
> 
> Probably not.  If 'resize-mini-windows' is t, we never unfreeze window
> starts because we don't call shrink_mini_window in that case.
> 
>  > Should it matter whether, if the minibuffer is active, we do that only
>  > at the outer level of minibuffer?
> 
> It shouldn't.  Window starts would be frozen immediately as soon as the
> mini window grows again.  I think that to cover most cases we should
> unfreeze window starts every time the mini window gets smaller as in the
> patch below.

Is that in addition to what I suggested to do in shrink_mini_window?

Also, shouldn't we do this instead:

> -      FRAME_WINDOWS_FROZEN (f) = true;
> +      FRAME_WINDOWS_FROZEN (f) = (old_height + delta > min_height) ? true : false;

IOW, shouldn't we unfreeze only when resizing to the default one-line
height?





  reply	other threads:[~2024-04-14  9:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 20:25 bug#70038: 29.3.50; Shift up/down in buffer with images on M-x other-window with some fonts Ramon Diaz-Uriarte
2024-03-28  5:58 ` Eli Zaretskii
2024-03-28  7:52   ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-28  8:36     ` Eli Zaretskii
2024-03-28 16:12   ` Ramon Diaz-Uriarte
2024-03-28 16:59     ` Ramon Diaz-Uriarte
2024-03-28 17:24       ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-28 19:50         ` Rahguzar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-31 18:43           ` Ramon Diaz-Uriarte
2024-04-06 12:33         ` Eli Zaretskii
2024-04-06 14:08           ` Eli Zaretskii
2024-04-06 14:20             ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-07  8:24             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-07  9:13               ` Eli Zaretskii
2024-04-07 10:12                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-07 11:28                   ` Eli Zaretskii
2024-04-08  9:07                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13 10:10                       ` Eli Zaretskii
2024-04-14  8:31                         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-14  9:28                           ` Eli Zaretskii [this message]
2024-04-15  9:23                             ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-15 13:54                               ` Eli Zaretskii
2024-04-17  8:02                                 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17 12:58                                   ` Eli Zaretskii
2024-04-28  8:51                                     ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-28  9:15                                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29  9:47                                         ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-29 12:51                                       ` Eli Zaretskii
2024-04-11 13:56           ` Ramon Diaz-Uriarte
2024-04-11 15:36             ` Eli Zaretskii
2024-04-12 16:43               ` Ramon Diaz-Uriarte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865xwknvhs.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=70038@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.