unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Native line numbers display and tab stops
@ 2017-06-23 15:08 Eli Zaretskii
  2017-06-23 17:33 ` Dmitry Gutov
  2017-06-23 17:50 ` Alan Mackenzie
  0 siblings, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2017-06-23 15:08 UTC (permalink / raw)
  To: emacs-devel

Someone reported on Reddit that turning on native line numbers display
(available on the line-numbers branch) doesn't update the tab stops to
start from zero after the line numbers.  This looked like a bug, but I
see that the same happens when line-prefix is set to a non-nil value.

So maybe this is a feature?  What do people think?  Should I fix this
for all display features which insert stuff before the line beginning?

TIA



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Native line numbers display and tab stops
  2017-06-23 15:08 Native line numbers display and tab stops Eli Zaretskii
@ 2017-06-23 17:33 ` Dmitry Gutov
  2017-06-23 17:50 ` Alan Mackenzie
  1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Gutov @ 2017-06-23 17:33 UTC (permalink / raw)
  To: Eli Zaretskii, emacs-devel

On 6/23/17 6:08 PM, Eli Zaretskii wrote:

> So maybe this is a feature?  What do people think?  Should I fix this
> for all display features which insert stuff before the line beginning?

I imagine it could be working as intended at least in some cases where 
line-prefix is set via text property (we should probably look at the 
existing uses). After all, tab stops are about lining up text visually.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Native line numbers display and tab stops
  2017-06-23 15:08 Native line numbers display and tab stops Eli Zaretskii
  2017-06-23 17:33 ` Dmitry Gutov
@ 2017-06-23 17:50 ` Alan Mackenzie
  2017-06-23 21:09   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2017-06-23 17:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Hello, Eli.

On Fri, Jun 23, 2017 at 18:08:09 +0300, Eli Zaretskii wrote:
> Someone reported on Reddit that turning on native line numbers display
> (available on the line-numbers branch) doesn't update the tab stops to
> start from zero after the line numbers.  This looked like a bug, but I
> see that the same happens when line-prefix is set to a non-nil value.

> So maybe this is a feature?  What do people think?  Should I fix this
> for all display features which insert stuff before the line beginning?

Well, as far as the line numbers are concerned, they are a pure display
feature.  They should not affect editing commands.  I think it is a bug
if a user types `tab-to-tab-stop' on one line, switches on the line
numbers, then types the same on the next line and finds that the two
places tabbed to don't line up.

Whether it's a bug with other display features, I can't really say,
because I'm not familiar enough with them.

> TIA

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Native line numbers display and tab stops
  2017-06-23 17:50 ` Alan Mackenzie
@ 2017-06-23 21:09   ` Eli Zaretskii
  2017-06-23 22:27     ` John Wiegley
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2017-06-23 21:09 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Fri, 23 Jun 2017 17:50:09 +0000
> Cc: emacs-devel@gnu.org
> From: Alan Mackenzie <acm@muc.de>
> 
> I think it is a bug if a user types `tab-to-tab-stop' on one line,
> switches on the line numbers, then types the same on the next line
> and finds that the two places tabbed to don't line up.

They _will_ line up.  They just won't be at column 8 relative to the
beginning of the line's text.

When you switch on line numbers, text of all lines is pushed to the
right, but tab stops are left in the same horizontal position.  They
are all left at that position, so they still line up.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Native line numbers display and tab stops
  2017-06-23 21:09   ` Eli Zaretskii
@ 2017-06-23 22:27     ` John Wiegley
  2017-06-23 23:02       ` Stephen Berman
  2017-06-24 17:31       ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: John Wiegley @ 2017-06-23 22:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alan Mackenzie, emacs-devel

>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:

EZ> When you switch on line numbers, text of all lines is pushed to the right,
EZ> but tab stops are left in the same horizontal position. They are all left
EZ> at that position, so they still line up.

Not having tried it, but that does sound counter-intuitive at first glance...

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Native line numbers display and tab stops
  2017-06-23 22:27     ` John Wiegley
@ 2017-06-23 23:02       ` Stephen Berman
  2017-06-24 17:31       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Berman @ 2017-06-23 23:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alan Mackenzie, emacs-devel

On Fri, 23 Jun 2017 15:27:46 -0700 John Wiegley <jwiegley@gmail.com> wrote:

>>>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
>
> EZ> When you switch on line numbers, text of all lines is pushed to the right,
> EZ> but tab stops are left in the same horizontal position. They are all left
> EZ> at that position, so they still line up.
>
> Not having tried it, but that does sound counter-intuitive at first glance...

The interaction with goal-column is odd.  E.g. in *scratch*:

1. M-x fundamental-mode
2. M-: (setq display-line-numbers t)
3. M-x column-number-mode
4. TAB push the text of first line rightward, so that the first `;' is
   positioned on `o' in `To' on the second line, which the mode line
   indicates is column 8.
5. C-x C-n SPC to set the goal-column to 8.
6. C-n to move down to the second line.
=> Point is now not on the `o' in `To' but on the `e' in `create', four
   columns to the right (but still column 8 according to the mode line
   indicator).  In other words, though the movement correctly preserves
   the goal column, visually it appears not to.

The same effect happens when setting line-prefix (as expected, given
what Eli pointed out).

Steve Berman



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Native line numbers display and tab stops
  2017-06-23 22:27     ` John Wiegley
  2017-06-23 23:02       ` Stephen Berman
@ 2017-06-24 17:31       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2017-06-24 17:31 UTC (permalink / raw)
  To: John Wiegley; +Cc: acm, emacs-devel

> From: John Wiegley <jwiegley@gmail.com>
> Date: Fri, 23 Jun 2017 15:27:46 -0700
> Cc: Alan Mackenzie <acm@muc.de>, emacs-devel@gnu.org
> 
> >>>>> "EZ" == Eli Zaretskii <eliz@gnu.org> writes:
> 
> EZ> When you switch on line numbers, text of all lines is pushed to the right,
> EZ> but tab stops are left in the same horizontal position. They are all left
> EZ> at that position, so they still line up.
> 
> Not having tried it, but that does sound counter-intuitive at first glance...

I eventually convinced myself that this should be fixed, but I only
did that for the case of line-number display.  Other use cases, like
line-prefix, remain unchanged.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-06-24 17:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-23 15:08 Native line numbers display and tab stops Eli Zaretskii
2017-06-23 17:33 ` Dmitry Gutov
2017-06-23 17:50 ` Alan Mackenzie
2017-06-23 21:09   ` Eli Zaretskii
2017-06-23 22:27     ` John Wiegley
2017-06-23 23:02       ` Stephen Berman
2017-06-24 17:31       ` Eli Zaretskii

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).