After figuring out a couple of nasty crashes I came up with a patch which works for all display specs coming from buffer text itself. But I've just realized that some fringe sources are still unhandled here. For example, when the fringe indicator is defined in non-buffer strings, like overlays with 'before-string/'after-string properties. Just iterating through text positions doesn't scan any of that. This means that we'd have to imitate more of the iterator logic when looking for display specs containing help-echo. Do we want to manage fringe help-echo text coming from various strings as well? Certainly doable. I wonder if this asks for a separate patch. Thanks On Sat, 23 Dec 2023 at 13:40, Eli Zaretskii wrote: > > > From: Vladimir Kazanov > > Date: Sat, 23 Dec 2023 13:28:48 +0000 > > Cc: emacs-devel@gnu.org > > > > 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... */ > > } > > Yes, I think you are right. But I think it is better to use > row->minpos and row->maxpos; see the comments in dispextern.h for the > reasons why. > > > > 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? > > No, that's not what I meant. I only meant to assign the tip string to > help_echo_string like we do in other places in that function. > > > Either way, I'd need to test this thoroughly, I suspect there might be > > interesting corner cases. > > There always are, IME. > > Thanks. -- Regards, Vladimir Kazanov