unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
@ 2019-05-09 19:15 clemera
  2019-05-10  7:14 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: clemera @ 2019-05-09 19:15 UTC (permalink / raw)
  To: 35659

Hello,

After starting emacs -Q I set the following settings by evaluating them in *scratch*:

(setq auto-hscroll-mode 'current-line
      hscroll-step 1
      truncate-lines t)

Now after adding a long line right after the above code block (which exceeds the frame width)
go to the end of the long line. The line scrolls as expected but when you go from there to the lines above, those get
pushed to the left. I have recorded a gif which shows the described behavior:

https://imgur.com/a/lJYo4Od


In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2019-01-03 built on clemera
Repository revision: ab525dd6b1c57cee7f26700f9656bb6c76a8ceba
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description:	Ubuntu 18.04.2 LTS

Recent messages:
Making completion list...
nil
t
Mark set [17 times]
funcall-interactively: End of buffer [7 times]
Quit
user-error: Beginning of history; no preceding item
Quit [3 times]
nil
t
Quit
Configured using:
 'configure --with-xft --with-x-toolkit=gtk3 --with-modules'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LCMS2

Important settings:
  value of $LC_MONETARY: de_DE.UTF-8
  value of $LC_NUMERIC: de_DE.UTF-8
  value of $LC_TIME: de_DE.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 98229 13360)
 (symbols 48 20364 1)
 (miscs 40 78 244)
 (strings 32 28371 1265)
 (string-bytes 1 747151)
 (vectors 16 14656)
 (vector-slots 8 497062 7570)
 (floats 8 50 298)
 (intervals 56 551 9)
 (buffers 992 12))





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-09 19:15 bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step` clemera
@ 2019-05-10  7:14 ` Eli Zaretskii
  2019-05-10 12:37 ` Clemens Radermacher
  2019-08-27  0:06 ` Stefan Kangas
  2 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2019-05-10  7:14 UTC (permalink / raw)
  To: clemera; +Cc: 35659

tags 35659 notabug
thanks

> From: clemera <clemera@posteo.net>
> Date: Thu, 9 May 2019 21:15:26 +0200
> 
> After starting emacs -Q I set the following settings by evaluating them in *scratch*:
> 
> (setq auto-hscroll-mode 'current-line
>       hscroll-step 1
>       truncate-lines t)
> 
> Now after adding a long line right after the above code block (which exceeds the frame width)
> go to the end of the long line. The line scrolls as expected but when you go from there to the lines above, those get
> pushed to the left. I have recorded a gif which shows the described behavior:
> 
> https://imgur.com/a/lJYo4Od

This is the normal behavior of C-n and C-p (UP and DOWN arrow keys):
they try to move into the same column of the next/previous line as the
one of the line you started with.  The rationale is to allow you to
see the same horizontal region in the lines through which you
traverse.  Neither auto-hscroll-mode nor the current-line hscrolling
feature change that basic behavior.

If we were to disable this feature, typing C-n followed by C-p would
not return you back to the same column; you'd need to manually go to
the original column instead.  That'd be an annoyance, I think, as it
would effectively throw away your hscroll each time you move to
another line.

So I don't think there's a bug here.





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-09 19:15 bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step` clemera
  2019-05-10  7:14 ` Eli Zaretskii
@ 2019-05-10 12:37 ` Clemens Radermacher
  2019-05-10 13:02   ` Eli Zaretskii
  2019-08-27  0:06 ` Stefan Kangas
  2 siblings, 1 reply; 11+ messages in thread
From: Clemens Radermacher @ 2019-05-10 12:37 UTC (permalink / raw)
  To: 35659

> Neither auto-hscroll-mode nor the current-line hscrolling
> feature change that basic behavior.

When I do the described steps with hscroll-step set to 0 I don't get this
behavior. Then it is the way I would like it to be (just go to the end of the previous
line without scrolling it when it doesn't exceeds the window width). 

In my opinion the behavior in the gif is a bug,
the lines which do no exceed the window width should not be scrolled should they?


        Clemens





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-10 12:37 ` Clemens Radermacher
@ 2019-05-10 13:02   ` Eli Zaretskii
  2019-05-10 13:24     ` Clemens Radermacher
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2019-05-10 13:02 UTC (permalink / raw)
  To: Clemens Radermacher; +Cc: 35659

> Cc: eliz@gnu.org
> From: Clemens Radermacher <clemens.radermacher@posteo.de>
> Date: Fri, 10 May 2019 14:37:59 +0200
> 
> > Neither auto-hscroll-mode nor the current-line hscrolling
> > feature change that basic behavior.
> 
> When I do the described steps with hscroll-step set to 0 I don't get this
> behavior. Then it is the way I would like it to be (just go to the end of the previous
> line without scrolling it when it doesn't exceeds the window width). 

Then I guess you already have the solution that fits your needs,
right?

> In my opinion the behavior in the gif is a bug,
> the lines which do no exceed the window width should not be scrolled should they?

By default, they are scrolled, exactly as they are when
auto-hscroll-mode is t.  You are saying that the 'current-line' mode
should behave differently because of some different expectations in
that specific case.  That's debatable, but the fact is the code which
implements that mode was never meant to change this basic behavior of
horizontal scrolling.

If someone wants to write code to cater also to the behavior you want
to see, I promise to review it.  But I won't myself work on this, as
this area of the Emacs display is already quite tricky and full of
subtleties.  Sorry.





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-10 13:02   ` Eli Zaretskii
@ 2019-05-10 13:24     ` Clemens Radermacher
  2019-05-10 13:34       ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Clemens Radermacher @ 2019-05-10 13:24 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 35659

> By default, they are scrolled, exactly as they are when
> auto-hscroll-mode is t.

Thank you for looking into it again! I think you haven't looked closely enough:
This is not the behavior you get with auto-hscroll-mode set to t. 

> Then I guess you already have the solution that fits your needs,
> right?

No, because I would like hscroll-step to be set to 1. But doing that
will lead to the described pushing of lines over the screen (which is what you want
if the lines exceed the window width but not if they are shorter than the window-width!)

I would flag it as a bug because it does not happen with 
hscroll-step set to 0 (the default).
  
> If someone wants to write code to cater also to the behavior you want
> to see, I promise to review it.  But I won't myself work on this, as
> this area of the Emacs display is already quite tricky and full of
> subtleties.  Sorry.

If you don't want to touch that code, I as a newbie won't dare to touch it either ;)



        Clemens





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-10 13:24     ` Clemens Radermacher
@ 2019-05-10 13:34       ` Eli Zaretskii
  2019-05-10 13:44         ` Clemens Radermacher
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2019-05-10 13:34 UTC (permalink / raw)
  To: Clemens Radermacher; +Cc: 35659

> Cc: 35659@debbugs.gnu.org
> From: Clemens Radermacher <clemens.radermacher@posteo.de>
> Date: Fri, 10 May 2019 15:24:00 +0200
> 
> > By default, they are scrolled, exactly as they are when
> > auto-hscroll-mode is t.
> 
> This is not the behavior you get with auto-hscroll-mode set to t. 

Maybe I'm confused: what is the "behavior you get with
auto-hscroll-mode set to t" to which you allude here?

> If you don't want to touch that code, I as a newbie won't dare to touch it either ;)

I definitely don't.  Someone challenged me to provide this "scroll
only the current line" mode in Emacs, so I coded it.  I definitely
don't want to make it messier than it is already.  Still, volunteers
are welcome.





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-10 13:34       ` Eli Zaretskii
@ 2019-05-10 13:44         ` Clemens Radermacher
  2019-05-10 14:03           ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Clemens Radermacher @ 2019-05-10 13:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 35659

>> > By default, they are scrolled, exactly as they are when
>> > auto-hscroll-mode is t.
>> 
>> This is not the behavior you get with auto-hscroll-mode set to t. 
> 
> Maybe I'm confused: what is the "behavior you get with
> auto-hscroll-mode set to t" to which you allude here?

Sorry, it seems I was wrong. The window stays scrolled for the shorter lines 
here, as well (unless it's an empty one, then the scrolling resets).  

Still I think when the shorter lines don't get pushed around
with hscroll-step 0, it shouldn't happen with hscroll-step set to another value.


>> If you don't want to touch that code, I as a newbie won't dare to touch it either ;)
> 
> I definitely don't.  Someone challenged me to provide this "scroll
> only the current line" mode in Emacs, so I coded it.  I definitely
> don't want to make it messier than it is already.  Still, volunteers
> are welcome.

Thank you for doing it, it's really a great feature and I like it. I guess
I have to live with the default setting for hscroll-step then.

        Clemens





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-10 13:44         ` Clemens Radermacher
@ 2019-05-10 14:03           ` Eli Zaretskii
  2019-05-10 14:25             ` Clemens Radermacher
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2019-05-10 14:03 UTC (permalink / raw)
  To: Clemens Radermacher; +Cc: 35659

> Cc: 35659@debbugs.gnu.org
> From: Clemens Radermacher <clemens.radermacher@posteo.de>
> Date: Fri, 10 May 2019 15:44:01 +0200
> 
> Still I think when the shorter lines don't get pushed around
> with hscroll-step 0, it shouldn't happen with hscroll-step set to another value.

I think the fact that it happens for hscroll-step of zero is "by sheer
luck".  I certainly don't remember explicitly coding that.

> Thank you for doing it, it's really a great feature and I like it. I guess
> I have to live with the default setting for hscroll-step then.

Maybe someone will find an easy fix, volunteers are welcome.  Emacs
really shouldn't depend for its display code development on one old
curmudgeon such as myself...





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-10 14:03           ` Eli Zaretskii
@ 2019-05-10 14:25             ` Clemens Radermacher
  2019-05-10 15:14               ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Clemens Radermacher @ 2019-05-10 14:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 35659


> I think the fact that it happens for hscroll-step of zero is "by sheer
> luck".  I certainly don't remember explicitly coding that.

Programmers need luck, too ;)

> Maybe someone will find an easy fix, volunteers are welcome.  Emacs
> really shouldn't depend for its display code development on one old
> curmudgeon such as myself...

I had some success with this workaround (ugly but it's enough for my use case):

    (defun my-temporary-change-hscroll (f &rest args)
      (setq hscroll-step 0)
      (apply f args)
      (run-at-time 0.1 nil
                   (lambda ()
                     (setq hscroll-step 1))))

    (advice-add #'previous-line :around 'my-temporary-change-hscroll)
    (advice-add #'next-line :around 'my-temporary-change-hscroll)

I would really like to dig into it but I hardly know any C and I have read several times
that the Emacs code base is reserved for advanced C programmers. Thank you for 
all the work you are doing, Emacs is such a great software!

        Clemens





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-10 14:25             ` Clemens Radermacher
@ 2019-05-10 15:14               ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2019-05-10 15:14 UTC (permalink / raw)
  To: Clemens Radermacher; +Cc: 35659

> Cc: 35659@debbugs.gnu.org
> From: Clemens Radermacher <clemens.radermacher@posteo.de>
> Date: Fri, 10 May 2019 16:25:05 +0200
> 
> I have read several times that the Emacs code base is reserved for
> advanced C programmers.

This is definitely not true.  Emacs's C code is not hard to read and
understand, and there are enough people on emacs-devel who will gladly
answer questions regarding why we do things like we do.

> Thank you for all the work you are doing, Emacs is such a great
> software!

You are welcome.





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

* bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step`.
  2019-05-09 19:15 bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step` clemera
  2019-05-10  7:14 ` Eli Zaretskii
  2019-05-10 12:37 ` Clemens Radermacher
@ 2019-08-27  0:06 ` Stefan Kangas
  2 siblings, 0 replies; 11+ messages in thread
From: Stefan Kangas @ 2019-08-27  0:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Clemens Radermacher, 35659

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

tags 35659 - notabug
severity 35659 wishlist
quit

Eli Zaretskii <eliz@gnu.org> writes:

> If someone wants to write code to cater also to the behavior you want
> to see, I promise to review it.  But I won't myself work on this, as
> this area of the Emacs display is already quite tricky and full of
> subtleties.  Sorry.

In other words, patches welcome.

I'm attaching for posterity also the gif from the original bug report
(it was only 57 KB).  I hope that's okay.

Thanks,
Stefan Kangas

[-- Attachment #2: bug-35659.gif --]
[-- Type: image/gif, Size: 57592 bytes --]

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

end of thread, other threads:[~2019-08-27  0:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09 19:15 bug#35659: 26.1; Weird horizontal scroll behavior with certain settings for `auto-hscroll-mode' and `hscroll-step` clemera
2019-05-10  7:14 ` Eli Zaretskii
2019-05-10 12:37 ` Clemens Radermacher
2019-05-10 13:02   ` Eli Zaretskii
2019-05-10 13:24     ` Clemens Radermacher
2019-05-10 13:34       ` Eli Zaretskii
2019-05-10 13:44         ` Clemens Radermacher
2019-05-10 14:03           ` Eli Zaretskii
2019-05-10 14:25             ` Clemens Radermacher
2019-05-10 15:14               ` Eli Zaretskii
2019-08-27  0:06 ` Stefan Kangas

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