unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Keith David Bershatsky <esq@lawlist.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Debugging printing to stderr prior glyph row values ....
Date: Thu, 23 May 2019 10:23:03 -0700	[thread overview]
Message-ID: <m28sux84qw.wl%esq@lawlist.com> (raw)

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 <eliz@gnu.org>
> 
> * * *
> 
> 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	other threads:[~2019-05-23 17:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 17:23 Keith David Bershatsky [this message]
2019-05-23 18:38 ` Debugging printing to stderr prior glyph row values Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2019-05-24 14:56 Keith David Bershatsky
2019-05-24  0:03 Keith David Bershatsky
2019-05-24  6:45 ` Eli Zaretskii
2019-05-23 22:01 Keith David Bershatsky
2019-05-23  4:14 Keith David Bershatsky
2019-05-23 14:43 ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m28sux84qw.wl%esq@lawlist.com \
    --to=esq@lawlist.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).