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

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

bug#13399: 24.3.50; Word-wrap can't wrap at zero-width space U-200B


From: Eli Zaretskii
Subject: bug#13399: 24.3.50; Word-wrap can't wrap at zero-width space U-200B
Date: Sat, 02 Feb 2013 19:52:19 +0200

> Date: Sat, 02 Feb 2013 17:48:42 +0100
> From: martin rudalics <address@hidden>
> CC: Stefan Monnier <address@hidden>, address@hidden
> 
> I rewrote `fit-window-to-buffer' and `fit-frame-to-buffer' using the
> display iterator.  Please have a look at the attached patch.

I looked at the C parts.

> --- src/dispextern.h  2013-01-02 16:13:04 +0000
> +++ src/dispextern.h  2013-02-02 14:56:54 +0000
> @@ -2489,6 +2489,9 @@
>       pixel_width with each call to produce_glyphs.  */
>    int current_x;
>  
> +  /* Maximum x pixel position encountered within a display line.  */
> +  int max_current_x;

Adding a struct member for the sake of just one user sounds
unjustified.  Can we instead make move_it_to accumulate the value
internally and return it?

In any case, the comment is inaccurate, since the value is accumulated
across all the display lines traversed by the iterator, not computed
per display line.

> +DEFUN ("window-buffer-pixel-size", Fwindow_buffer_pixel_size, 
> Swindow_buffer_pixel_size, 0, 5, 0,

Why not window-text-pixel-size?  The "buffer" part doesn't belong
here, I think.

> +       doc: /* Return size of WINDOW's buffer in pixels.
> +WINDOW must be a live window and defaults to the selected one.  The
> +return value is a cons of the maximum pixel-width of any line and the
> +maximum pixel-height of all lines.
> +
> +The optional argument X_LIMIT, if non-nil, specifies the maximum
> +pixel-width that can be returned.  X_LIMIT nil or omitted, means to use
> +the pixel-width of WINDOW's body; use this if you do not intend to
> +change the width of WINDOW.  Use the maximum width WINDOW can be
> +expanded to if you intend to change WINDOW's width.
> +
> +The optional argument Y_LIMIT, if non-nil, specifies the maximum
> +pixel-height to scan.  Lines starting below Y_LIMIT are not scanned.

"Lines starting below Y_LIMIT" is ambiguous.  I suggest

  Lines whose y-coordinate is beyond Y_LIMIT will not be scanned.

> +Since calculating the pixel-height of a large buffer can take some time,
> +it makes sense to specify this argument if the size of the buffer is
> +unknown.  */)

The doc string keeps silent about arguments FROM and TO.

> +  /* Actually, we never want move_it_to stop at to_x.  But to make sure
> +     that move_it_in_display_line_to always moves far enough, we set it
> +     to MOST_POSITIVE_FIXNUM and specify MOVE_TO_X.  */
> +  move_it_to (&it, end, MOST_POSITIVE_FIXNUM, max_y, -1,
> +           MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);

Did you test what this does when END is covered by a display string?

Thanks.





reply via email to

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