emacs-devel
[Top][All Lists]
Advanced

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

Re: Debugging printing to stderr prior glyph row values ....


From: Keith David Bershatsky
Subject: Re: Debugging printing to stderr prior glyph row values ....
Date: Thu, 23 May 2019 10:23:03 -0700

Thank you, Eli, for having a look at this particular thread.

I will add a test for the `used` row member to ensure that it is positive.  The 
crashing reported in the initial post only happens somtimes, so I'll need to do 
some further testing.

The current issue relates to a window displaying a buffer, and the 
leading/introductory function used to draw fake cursors has a check at the 
outset:

  if (!BUFFERP (w->contents))
    return;

I am looking to programmatically distinguish between the following three types 
of consecutive rows:  (1) the penultimate row _not_ ending in ZV that 
immediately precedes a row with _only_ ZV; (2) the last row that contains 
_only_ ZV; and, (3) rows that follow a row with _only_ ZV.

  Every good boy deserves fudge.ΒΆ
  ZV<==
  [one or more ' ' space glyphs]
  [one or more ' ' space glyphs]
  Mode-Line

Fake cursors are drawn immediately after each section [HPOS + LEN] of a 
potentially updated row in the desired_matrix is processed by update_window; 
and, then fake cursors are drawn on _other_ rows using the current_matrix 
(after all potentially updated rows have been processed using the 
desired_matrix).

Situation number 2 is labeled below as row_at_zv_p; and, stuation number 3 is 
labeled below as row_beyond_zv_p.  The problem I forsee with the row_at_zv_p 
test is that there is no guarantee that ROW - 1 will be enabled in the MATRIX 
containing ROW, and the test is therefore unreliable.

  bool row_at_zv_p = (MATRIX_ROW_START_BYTEPOS (row - 1) != 
MATRIX_ROW_END_BYTEPOS (row - 1)
                      && !(row - 1)->ends_at_zv_p
                      && MATRIX_ROW_START_BYTEPOS (row) == 
MATRIX_ROW_END_BYTEPOS (row)
                      && row->ends_at_zv_p);

  bool row_beyond_zv_p = (MATRIX_ROW_START_BYTEPOS (row) == 
MATRIX_ROW_END_BYTEPOS (row));

A better method of determining row_at_zv_p (without consulting ROW - 1) would 
be appreciated, if such a test exists.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

> Date: [05-23-2019 07:43:14] <23 May 2019 17:43:14 +0300>
> From: Eli Zaretskii <address@hidden>
> 
> * * *
> 
> You didn't tell enough about the situation.  E.g., what kind of window
> is that -- a window that shows a buffer, or something else?  How many
> rows are in that window?  What is the full content or ROW and ROW-1?
> 
> One potential problem I see is that this doesn't test the 'used'
> member:
> 
>   struct glyph *previous_row__last_glyph
>     = (vpos == 0)
>         ? NULL
>       : (!(row - 1)->enabled_p)
>         ? NULL
>       : (row - 1)->glyphs[TEXT_AREA] + (row - 1)->used[TEXT_AREA] - 1;
> 
> The 'used' member should be positive, or else subtracting 1 is not
> allowed.



reply via email to

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