unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Romanos Skiadas <rom.skiad@gmail.com>
Cc: 28533@debbugs.gnu.org
Subject: bug#28533: 26.0.60; Native line numbers move with show-paren-mode enabled
Date: Thu, 21 Sep 2017 12:11:42 +0300	[thread overview]
Message-ID: <83wp4se7qp.fsf@gnu.org> (raw)
In-Reply-To: <821a99c1-2f86-a13b-31bb-06d7898fe9c3@gmail.com> (message from Romanos Skiadas on Wed, 20 Sep 2017 21:14:02 +0100)

> From: Romanos Skiadas <rom.skiad@gmail.com>
> Date: Wed, 20 Sep 2017 21:14:02 +0100
> 
> - Start emacs
> ./src/emacs -Q --eval "(add-hook 'text-mode-hook (lambda () 
> (display-line-numbers-mode)))" --eval "(show-paren-mode 1)" /tmp/test.org
> 
> - Write about 100 lines or so and fold the org header. Something like
> 1 * Foo...[100 lines folded here]
> 
> - Enter a pair of parens under the folded header:
> 1 * Foo...
> 123 ()
> 
> - Move the point from left to right with C-f and the line number moves:
> 1 * Foo...
> 123 |()
> 123 (|)
> 123 ()|
> 
> As far as I could tell, without the folded lines or show-paren-mode this
> does not happen. It can also be replicated in modes other than org by
> using set-selective-display.

In modes that hide many lines from display, you should customize
display-line-numbers-width-start to a non-nil value, or manually set
display-line-numbers-width to a value large enough to accommodate the
last physical line of the file (e.g., in file-local variables).
Otherwise the default calculation of the width required for line
numbers will come up with a value that is lower than necessary, and
you will frequently see that some lines displayed in the window are
shifted to the right due to this miscalculation.

This issue is part of that more general problem.  What happens here is
that the original calculation of the width of line-number display is
incorrect, and the additional redisplay cycle caused by moving the
show-parent overlay "corrects" it.

Note that this effect is only seen on the last line of the file, and
AFAICS only as long as you don't save the buffer.

Based on the fact that having line numbers in buffers under
selective-display requires customization of the provided options,
which then makes this problem go away, I don't think any fix is
required for this use case.  If you agree, I will close this bug.

Thanks.





  parent reply	other threads:[~2017-09-21  9:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 20:14 bug#28533: 26.0.60; Native line numbers move with show-paren-mode enabled Romanos Skiadas
2017-09-20 20:42 ` Romanos Skiadas
2017-09-21  9:11 ` Eli Zaretskii [this message]
2017-09-21 21:11   ` Romanos Skiadas
2017-09-22  7:22     ` Eli Zaretskii
     [not found]       ` <985db77a-8f22-34c8-a60c-45fe2c2999ea@gmail.com>
     [not found]         ` <83h8vtc3jf.fsf@gnu.org>
2017-09-23  8:49           ` Romanos Skiadas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wp4se7qp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=28533@debbugs.gnu.org \
    --cc=rom.skiad@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).