From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] User-defined fringe tooltips (a request for review) Date: Sat, 23 Dec 2023 15:40:18 +0200 Message-ID: <83plyxca0t.fsf@gnu.org> References: <83sf3xgimq.fsf@gnu.org> <83plyzfoe4.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21909"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Vladimir Kazanov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 23 14:41:22 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rH2Fl-0005Ys-Gw for ged-emacs-devel@m.gmane-mx.org; Sat, 23 Dec 2023 14:41:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rH2Ew-0007gy-7D; Sat, 23 Dec 2023 08:40:30 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rH2Et-0007gb-OD for emacs-devel@gnu.org; Sat, 23 Dec 2023 08:40:28 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rH2Et-00086A-DG; Sat, 23 Dec 2023 08:40:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=kNwgfoVYEnUiuOza7u6EKbveinT3hid4cIJIaZIqqlQ=; b=jHr9ZtlyUu5x iA9Ef6x/FharDhPC9oZS2ZP8askz+RjshYBqet7e2iuMjuJiVfkrTxlBV2pJ57EdjYYJcDXftcIKN Wvl9InXzUAP4DpWFpRLZFJGDEiYv2ClFecSPetrdyx/i5dD51Q7aIByfG9KNTXTbjXlCkcbEi/vE8 WYoGo6hnZBDDVgM40jtli9hiqhWvmQew73eaLXRR/R8Vc2gXrpxb4OF6M9DdKd1LxIrjC/KDGDq/8 qVyvgNbZ47xF6IYT0v41RvMiEy/Ufnddk4e7C9t7qwgGw8K+C3aIdP7057BciuvvjaXLw62DTKwrb lt4GLHhiYw7UUES8EjQ1mg==; In-Reply-To: (message from Vladimir Kazanov on Sat, 23 Dec 2023 13:28:48 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:314102 Archived-At: > 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.