bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#27647: 26.0.50; Line numbers implemented natively disappear momentar


From: Noam Postavsky
Subject: bug#27647: 26.0.50; Line numbers implemented natively disappear momentarily when frame out of focus
Date: Wed, 08 Nov 2017 21:49:31 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

tags 27647 + patch
quit

Alex <address@hidden> writes:

> Alex <address@hidden> writes:
>
>> I coincidentally stumbled across an easy recipe for this bug (or at
>> least a similar bug):
>>
>> M-: (setq display-line-numbers t)
>> M-: (setq mouse-drag-and-drop-region t)
>>
>> Then select a region, click on it (mouse-1), and drag the mouse. The
>> line numbers will disappear until you release the mouse.
>>
>> Hopefully you can reproduce this on your end this time, Eli. To be
>> clear, this is with a GTK build.
>
> Sorry, I should have also mentioned that this is indeed only the case
> when x-gtk-use-system-tooltips is non-nil.

Aha, the problem is this condition in should_produce_line_number:

    static bool
    should_produce_line_number (struct it *it)
    {
      ...
      /* Don't display line number in tooltip frames.  */
      if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame))
        return false;

Which sounds like it would be correct, except that the meaning of
tip_frame is different for GTK tooltips, as explained in x_hide_tip:

    static Lisp_Object
    x_hide_tip (bool delete)
    {
    ...
    #ifdef USE_GTK
          {
        /* When using system tooltip, tip_frame is the Emacs frame on
           which the tip is shown.  */
        struct frame *f = XFRAME (tip_frame);

Implemented in Fx_show_tip:

    DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
    ...
      f = decode_window_system_frame (frame);
    ...
    #ifdef USE_GTK
      if (x_gtk_use_system_tooltips)
        {
              ...
               /* This is used in Fx_hide_tip.  */
              XSETFRAME (tip_frame, f);

Leading to the following patch:

>From de99bf6af06aba4659740b8f3d892ff5db5bce03 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Wed, 8 Nov 2017 21:45:28 -0500
Subject: [PATCH v1] Fix line number display when using gtk tooltips
 (Bug#27647)

* src/xdisp.c (should_produce_line_number): Don't check tip_frame when
using gtk tooltips.
---
 src/xdisp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 69b74dc629..3b75811cc3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21126,7 +21126,8 @@ should_produce_line_number (struct it *it)
 
 #ifdef HAVE_WINDOW_SYSTEM
   /* Don't display line number in tooltip frames.  */
-  if (FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame))
+  if (!x_gtk_use_system_tooltips
+      && FRAMEP (tip_frame) && EQ (WINDOW_FRAME (it->w), tip_frame))
     return false;
 #endif
 
-- 
2.11.0


reply via email to

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