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

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

bug#32337: 26.1; display-line-numbers-mode makes cursor ill-aligned when


From: Eli Zaretskii
Subject: bug#32337: 26.1; display-line-numbers-mode makes cursor ill-aligned when number face is changed
Date: Wed, 26 Sep 2018 22:20:25 +0300

> From: Carlos Pita <carlosjosepita@gmail.com>
> Date: Wed, 26 Sep 2018 13:16:01 -0300
> Cc: rms@gnu.org, 32337@debbugs.gnu.org
> 
> Thanks Eli! For now your magic seems to be working wonders. I will let
> you know of my experience in two weeks. Thanks again!

One more improvement (I hope).  Please apply the below on top of
everything else.

diff --git a/src/xdisp.c b/src/xdisp.c
index eccefa4..357f0fb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -21235,23 +21238,30 @@ maybe_produce_line_number (struct it *it)
        }
     }
 
-  /* Update IT's metrics due to glyphs produced for line numbers.  */
-  if (it->glyph_row)
+  /* Update IT's metrics due to glyphs produced for line numbers.
+     Don't do that for rows beyond ZV, to avoid displaying a cursor of
+     different dimensions there.  */
+  if (!beyond_zv)
     {
-      struct glyph_row *row = it->glyph_row;
+      if (it->glyph_row)
+       {
+         struct glyph_row *row = it->glyph_row;
 
-      it->max_ascent = max (row->ascent, tem_it.max_ascent);
-      it->max_descent = max (row->height - row->ascent, tem_it.max_descent);
-      it->max_phys_ascent = max (row->phys_ascent, tem_it.max_phys_ascent);
-      it->max_phys_descent = max (row->phys_height - row->phys_ascent,
-                                 tem_it.max_phys_descent);
-    }
-  else
-    {
-      it->max_ascent = max (it->max_ascent, tem_it.max_ascent);
-      it->max_descent = max (it->max_descent, tem_it.max_descent);
-      it->max_phys_ascent = max (it->max_phys_ascent, tem_it.max_phys_ascent);
-      it->max_phys_descent = max (it->max_phys_descent, 
tem_it.max_phys_descent);
+         it->max_ascent = max (row->ascent, tem_it.max_ascent);
+         it->max_descent = max (row->height - row->ascent, tem_it.max_descent);
+         it->max_phys_ascent = max (row->phys_ascent, tem_it.max_phys_ascent);
+         it->max_phys_descent = max (row->phys_height - row->phys_ascent,
+                                     tem_it.max_phys_descent);
+       }
+      else
+       {
+         it->max_ascent = max (it->max_ascent, tem_it.max_ascent);
+         it->max_descent = max (it->max_descent, tem_it.max_descent);
+         it->max_phys_ascent = max (it->max_phys_ascent,
+                                    tem_it.max_phys_ascent);
+         it->max_phys_descent = max (it->max_phys_descent,
+                                     tem_it.max_phys_descent);
+       }
     }
 
   it->line_number_produced_p = true;





reply via email to

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