From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <838t3o83ra.fsf@gnu.org> References: <87effjtdpw.fsf@gmail.com> <838t5qo7cw.fsf@gnu.org> <83y3dqmhkl.fsf@gnu.org> <83va8umgok.fsf@gnu.org> <83tvoemfjo.fsf@gnu.org> <83bmakugtw.fsf@gnu.org> <83k1p6tzjj.fsf@gnu.org> <83in4qtxt0.fsf@gnu.org> <83va7p1glx.fsf@gnu.org> <83d0tpvj3j.fsf@gnu.org> <83o9cl8imu.fsf@gnu.org> <83d0t08dz5.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1537989607 3523 195.159.176.226 (26 Sep 2018 19:20:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 26 Sep 2018 19:20:07 +0000 (UTC) Cc: rms@gnu.org, 32337@debbugs.gnu.org To: Carlos Pita Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 26 21:20:03 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5FLu-0000oZ-BA for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Sep 2018 21:20:02 +0200 Original-Received: from localhost ([::1]:60352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5FO0-0000UJ-MY for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Sep 2018 15:22:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5FNt-0000UE-Ri for bug-gnu-emacs@gnu.org; Wed, 26 Sep 2018 15:22:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5FNp-0003YD-TJ for bug-gnu-emacs@gnu.org; Wed, 26 Sep 2018 15:22:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:51416) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5FNp-0003Y3-O2 for bug-gnu-emacs@gnu.org; Wed, 26 Sep 2018 15:22:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g5FNp-0005E3-JF for bug-gnu-emacs@gnu.org; Wed, 26 Sep 2018 15:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Sep 2018 19:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32337 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32337-submit@debbugs.gnu.org id=B32337.153798966220001 (code B ref 32337); Wed, 26 Sep 2018 19:22:01 +0000 Original-Received: (at 32337) by debbugs.gnu.org; 26 Sep 2018 19:21:02 +0000 Original-Received: from localhost ([127.0.0.1]:55674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5FMr-0005CT-Qb for submit@debbugs.gnu.org; Wed, 26 Sep 2018 15:21:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56359) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g5FMp-0005Bq-EQ for 32337@debbugs.gnu.org; Wed, 26 Sep 2018 15:20:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5FMg-0002bu-34 for 32337@debbugs.gnu.org; Wed, 26 Sep 2018 15:20:54 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5FMf-0002bq-Ve; Wed, 26 Sep 2018 15:20:50 -0400 Original-Received: from [176.228.60.248] (port=3075 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g5FMY-0005MQ-Fj; Wed, 26 Sep 2018 15:20:44 -0400 In-reply-to: (message from Carlos Pita on Wed, 26 Sep 2018 13:16:01 -0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:150688 Archived-At: > From: Carlos Pita > 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;