emacs-devel
[Top][All Lists]
Advanced

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

Re: move_it_vertically_backward question


From: Eli Zaretskii
Subject: Re: move_it_vertically_backward question
Date: Sun, 19 Dec 2021 20:07:49 +0200

> From: Po Lu <luangruo@yahoo.com>
> Cc: emacs-devel@gnu.org
> Date: Sun, 19 Dec 2021 18:25:07 +0800
> 
> +  if (movement != 0)
> +    {
> +      int last_y;
> +      it.current_y = 0;

The last assignment should be unnecessary here: start-display always
initializes the coordinates to zero.

> +      if (movement < 0)
> +     {
> +       while (it.current_y > movement)
> +         {
> +           last_y = it.current_y;
> +           move_it_vertically_backward (&it,
> +                                        abs (movement) + it.current_y);
> +
> +           if (it.current_y == last_y)
> +             break;
> +         }
> +     }
> +      else
> +     {
> +       move_it_vertically (&it, movement);
> +     }

I don't understand the different logic depending on the sign of
'movement' (and didn't we agree to use a better name for it?).

> +      it.current_y = (WINDOW_TAB_LINE_HEIGHT (w)
> +                   + WINDOW_HEADER_LINE_HEIGHT (w));
> +      start = clip_to_bounds (BEGV, IT_CHARPOS (it), ZV);
> +      start_y = it.current_y;
> +    }
> +  else
> +    {
> +      /* Start at the beginning of the line containing FROM.  Otherwise
> +      IT.current_x will be incorrectly set to zero at some arbitrary
> +      non-zero X coordinate.  */
> +      reseat_at_previous_visible_line_start (&it);
> +      it.current_x = it.hpos = 0;
> +      if (IT_CHARPOS (it) != start)
> +     move_it_to (&it, start, -1, -1, -1, MOVE_TO_POS);
> +    }

And here: why a different initial value for it.current_y, depending on
how FROM was specified?

(Again, I didn't yet pay attention to the documentation.)

Thanks.



reply via email to

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