unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vladimir Kazanov <vekazanov@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] User-defined fringe tooltips (a request for review)
Date: Sat, 23 Dec 2023 13:28:48 +0000	[thread overview]
Message-ID: <CAAs=0-2TEqKsRJLFTqY_8C5Wanr4QpqYjR3JNUiSnR1rywBjAw@mail.gmail.com> (raw)
In-Reply-To: <83plyzfoe4.fsf@gnu.org>

So I've spent some time playing with various buffer text arrangements
and looking into iterator code. Quite a read, I must say!

>
>   for (glyph = row->glyphs[TEXT_AREA];
>        glyph < row->glyphs[TEXT_AREA] + row->used[TEXT_AREA];
>        glyph++)
>
>

Just iterating through glyphs doesn't work as glyphs do not reflect
charpos'es within invisible parts of the buffer. If a
left-fringe/right-fringe display property is specified then the text
is invisible so there's no glyph having that charpos. The iterator
handles all of that, of course, this is why I didn't have to take it
into account the first time.

The way I see things now: the code has to iterate all charpos in the
right order, including invisible ones, and also check for display
properties in overlays. A glyph_row has information on where the row
starts and ends (row->start and row->end).

I want to do the following in note_mouse_highlight:

/* Get to the current glyph row */
struct glyph_row *row = MATRIX_ROW (w->current_matrix, vpos);
Lisp_Object left_caption = Qnil, right_caption = Qnil;

ptrdiff_t charpos;
ptrdiff_t charpos_start = row->start.pos.charpos;
ptrdiff_t charpos_end = row->end.pos.charpos;
for (charpos = charpos_start; charpos <= charpos_end; charpos++)
  {
    /* This can be either in text props or overlays, so check both */
    Lisp_Object spec = get_char_property_and_overlay (make_fixnum (charpos),
Qdisplay, Qnil, NULL);
    /* ... parse the spec... */
   }

> If Fget_text_property returns non-nil for the 'display' property, you
> will then need to look at the value and see whether it specifies a
> help-echo for the fringe; if it does, extract the string and assign it
> to 'help_echo_string'.

I've just realized that what you have in mind is reusing the standard
'help-echo property? The one used for tooltips on the text itself?
This might not work in all cases as some major modes remove top-level
help-echo properties for some reason - I didn't look into it
thoroughly.

Either way, I'd need to test this thoroughly, I suspect there might be
interesting corner cases.

Thanks

--
Regards,

Vladimir Kazanov



  reply	other threads:[~2023-12-23 13:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 19:38 [PATCH] User-defined fringe tooltips (a request for review) Vladimir Kazanov
2023-12-20 12:31 ` Eli Zaretskii
2023-12-21 16:51   ` Vladimir Kazanov
2023-12-21 17:37     ` Eli Zaretskii
2023-12-23 13:28       ` Vladimir Kazanov [this message]
2023-12-23 13:40         ` Eli Zaretskii
2023-12-24 11:31           ` Vladimir Kazanov
2023-12-24 16:54             ` Eli Zaretskii
2024-03-25 15:55               ` Vladimir Kazanov
2024-03-25 17:11                 ` Eli Zaretskii
2024-03-26 22:16                   ` Vladimir Kazanov
2024-03-27 10:59                     ` Vladimir Kazanov
2024-03-27 11:25                       ` Po Lu
2024-03-27 12:48                         ` Vladimir Kazanov
2024-03-27 11:25                       ` Po Lu
2024-03-31  8:36                       ` Eli Zaretskii
2024-04-07 11:14                         ` Vladimir Kazanov
2024-04-07 12:44                           ` Eli Zaretskii
2024-04-07 17:07                             ` Vladimir Kazanov
2024-04-07 18:40                               ` Eli Zaretskii
2024-04-08 14:41                                 ` Vladimir Kazanov
2024-04-13  9:14                                   ` Eli Zaretskii
2024-04-13  9:32                                     ` Vladimir Kazanov
2024-04-13 11:21                                       ` Eli Zaretskii
2024-04-13 14:53                                         ` Vladimir Kazanov
2024-04-13 15:47                                           ` Eli Zaretskii
2024-03-27 12:14                     ` Eli Zaretskii
2024-03-27 12:48                       ` Vladimir Kazanov

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='CAAs=0-2TEqKsRJLFTqY_8C5Wanr4QpqYjR3JNUiSnR1rywBjAw@mail.gmail.com' \
    --to=vekazanov@gmail.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).