GNU bug report logs - #57343
hscroll current-line scrolls short lines too far to the left

Previous Next

Package: emacs;

Reported by: Erik van Zwol <thejofat <at> gmail.com>

Date: Mon, 22 Aug 2022 16:43:02 UTC

Severity: normal

To reply to this bug, email your comments to 57343 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#57343; Package emacs. (Mon, 22 Aug 2022 16:43:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Erik van Zwol <thejofat <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 22 Aug 2022 16:43:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Erik van Zwol <thejofat <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: hscroll current-line scrolls short lines too far to the left
Date: Sun, 21 Aug 2022 22:03:29 -0600
[Message part 1 (text/plain, inline)]
starting from 'emacs -Q':
Toggle-truncate-lines (so that long lines are truncated)
Evaluate the following:
(setq auto-hscroll-mode 'current-line)
(setq hscroll-margin 5)
(setq hscroll-step 1)
Insert enough text such that the line starts to hscroll
On the line directly below, insert enough text to fill about half the
width of the frame
Move point to the long line near the end (must be hscrolling the single
line)
Move point down to the next line, it should hscroll even though it does
not need to
See the animated gifs on this post:
https://www.reddit.com/r/emacs/comments/wgef0b/looking_for_better_alternative_to_autohscrollmode/

I have attached a patch that I think fixes the issue.  Please tell me
how to proceed, and what other information you need.


In GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20)
 of 2021-11-22 built on erik-lair
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.3 LTS

Recent messages:
Type C-c C-c to finish, C-c C-k to cancel, and M-p and M-n to recover older
messages
Auto-saving...done
Formats have changed, recompiling...done
fart
Updating buffer list...done
Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help
Message saved
Saving file /home/erik/projects/emacs_build/emacs_git/.git/COMMIT_EDITMSG...
Wrote /home/erik/projects/emacs_build/emacs_git/.git/COMMIT_EDITMSG
Git finished

Configured features:
XPM JPEG TIFF GIF PNG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
LIBSELINUX GNUTLS FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS GTK3
X11 XDBE XIM MODULES THREADS PDUMPER GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: C/*l

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  flymake-mode: t
  lsp-diagnostics-mode: t
  company-mode: t
  lsp-headerline-breadcrumb-mode: t
  lsp-modeline-workspace-status-mode: t
  lsp-modeline-diagnostics-mode: t
  lsp-modeline-code-actions-mode: t
  bug-reference-prog-mode: t
  lsp-completion-mode: t
  lsp-managed-mode: t
  lsp-mode: t
  projectile-mode: t
  helm-mode: t
  helm-minibuffer-history-mode: t
  shell-dirtrack-mode: t
  helm--remap-mouse-mode: t
  async-bytecomp-package-mode: t
  global-highlight-parentheses-mode: t
  highlight-parentheses-mode: t
  global-linum-mode: t
  linum-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-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
  abbrev-mode: t
  hs-minor-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug sendmail helm-command helm-elisp
helm-eval edebug backtrace find-func helm-info clang-format magit-extras
goto-addr mule-util face-remap magit-submodule magit-obsolete
magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull
magit-fetch magit-clone magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log magit-diff smerge-mode diff git-commit
log-edit message rfc822 mml mml-sec epa gnus-util rmail rmail-loaddefs
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert
autorevert magit-margin magit-transient magit-process with-editor server
magit-mode transient magit-git magit-base which-func ido magit-section
benchmark crm compat-27 compat-26 compat compat-macs flymake-cc
flymake-proc flymake lsp-diagnostics company-oddmuse company-keywords
make-mode company-etags etags fileloop generator company-gtags
company-dabbrev-code company-dabbrev company-files company-clang
company-capf company-cmake company-semantic company-template
company-bbdb company lsp-headerline lsp-icons lsp-modeline lsp-lens
vc-git diff-mode bug-reference view lsp-zig lsp-steep lsp-svelte
lsp-sqls lsp-ruby-syntax-tree lsp-yaml lsp-xml lsp-vimscript lsp-vhdl
lsp-volar lsp-vetur lsp-html lsp-verilog lsp-vala lsp-v lsp-typeprof
lsp-ttcn3 lsp-toml lsp-terraform lsp-tex lsp-sorbet lsp-solargraph
lsp-rust lsp-rf lsp-remark lsp-racket lsp-r lsp-purescript lsp-pylsp
lsp-pyls lsp-pwsh lsp-php lsp-perlnavigator lsp-perl lsp-openscad
lsp-ocaml lsp-magik lsp-nix lsp-nim lsp-nginx lsp-marksman lsp-markdown
lsp-lua lsp-kotlin lsp-json lsp-javascript lsp-idris lsp-haxe lsp-groovy
lsp-hack lsp-graphql lsp-gleam lsp-go lsp-completion lsp-gdscript
lsp-fsharp lsp-fortran lsp-eslint lsp-erlang lsp-emmet lsp-elixir
lsp-elm lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp gnutls
lsp-crystal lsp-cmake lsp-clojure lsp-semantic-tokens lsp-clangd dom
lsp-beancount lsp-bash lsp-ansible lsp-angular lsp-ada lsp-actionscript
lsp-mode lsp-protocol yasnippet-snippets yasnippet xref project
tree-widget wid-edit spinner network-stream puny nsm rmc markdown-mode
noutline outline lv imenu ht inline f ewoc epg epg-config hideshow
cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine
cc-vars cc-defs image-file winner helm-external helm-net url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
mailcap tramp-archive tramp-gvfs url-util dbus xml spaceline-config
spaceline-segments s spaceline powerline powerline-separators color
powerline-themes dash rx helm-projectile warnings projectile skeleton
ibuf-macs find-dired lisp-mnt grep compile ibuf-ext ibuffer
ibuffer-loaddefs helm-mode helm-misc helm-files image-dired image-mode
exif filenotify dired-x dired-aux dired dired-loaddefs ffap thingatpt
tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat
shell pcomplete comint ring parse-time iso8601 time-date ls-lisp
helm-buffers helm-occur helm-tags helm-locate helm-grep helm-regexp
format-spec ansi-color helm-utils helm-help helm-types helm
helm-global-bindings helm-easymenu helm-core async-bytecomp helm-source
helm-multi-match helm-lib async helm-config highlight-parentheses
xterm-color linum manoj-dark-theme use-package-bind-key bind-key neotree
advice pcase edmacro kmacro general easy-mmode cl-extra help-mode
use-package-ensure use-package-core derived finder-inf info package
easymenu browse-url url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
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 tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer 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
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 threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 1056094 118790)
 (symbols 48 48788 1)
 (strings 32 140835 10073)
 (string-bytes 1 4818683)
 (vectors 16 70471)
 (vector-slots 8 2690660 1120416)
 (floats 8 407 502)
 (intervals 56 7515 1257)
 (buffers 1000 31))
[Message part 2 (text/html, inline)]
[0001-src-xdisp.c-hscroll_window_tree-hscroll-current-line.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57343; Package emacs. (Tue, 23 Aug 2022 13:14:02 GMT) Full text and rfc822 format available.

Message #8 received at 57343 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Erik van Zwol <thejofat <at> gmail.com>
Cc: 57343 <at> debbugs.gnu.org
Subject: Re: bug#57343: hscroll current-line scrolls short lines too far to the
 left
Date: Tue, 23 Aug 2022 16:13:27 +0300
> From: Erik van Zwol <thejofat <at> gmail.com>
> Date: Sun, 21 Aug 2022 22:03:29 -0600
> 
> starting from 'emacs -Q':
> Toggle-truncate-lines (so that long lines are truncated)
> Evaluate the following:
> (setq auto-hscroll-mode 'current-line)
> (setq hscroll-margin 5)
> (setq hscroll-step 1)
> Insert enough text such that the line starts to hscroll
> On the line directly below, insert enough text to fill about half the
> width of the frame
> Move point to the long line near the end (must be hscrolling the single
> line)
> Move point down to the next line, it should hscroll even though it does
> not need to
> See the animated gifs on this post:
> https://www.reddit.com/r/emacs/comments/wgef0b/looking_for_better_alternative_to_autohscrollmode/
> 
> I have attached a patch that I think fixes the issue.  Please tell me
> how to proceed, and what other information you need.

Thanks.

I feel there's something else at work here, because if you move the
cursor up instead of down (i.e., to the previous instead of the next
line), the problem doesn't happen.

So I need to look closer at what is going on and why.  Stay tuned.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57343; Package emacs. (Tue, 23 Aug 2022 16:57:01 GMT) Full text and rfc822 format available.

Message #11 received at 57343 <at> debbugs.gnu.org (full text, mbox):

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Erik van Zwol <thejofat <at> gmail.com>, 57343 <at> debbugs.gnu.org
Subject: Re: bug#57343: hscroll current-line scrolls short lines too far to
 the left
Date: Tue, 23 Aug 2022 18:56:34 +0200
[Message part 1 (text/plain, inline)]
On Tue, 23 Aug 2022 16:13:27 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>
>> From: Erik van Zwol <thejofat <at> gmail.com>
>> Date: Sun, 21 Aug 2022 22:03:29 -0600
>>
>> starting from 'emacs -Q':
>> Toggle-truncate-lines (so that long lines are truncated)
>> Evaluate the following:
>> (setq auto-hscroll-mode 'current-line)
>> (setq hscroll-margin 5)
>> (setq hscroll-step 1)
>> Insert enough text such that the line starts to hscroll
>> On the line directly below, insert enough text to fill about half the
>> width of the frame
>> Move point to the long line near the end (must be hscrolling the single
>> line)
>> Move point down to the next line, it should hscroll even though it does
>> not need to
>> See the animated gifs on this post:
>> https://www.reddit.com/r/emacs/comments/wgef0b/looking_for_better_alternative_to_autohscrollmode/
>>
>> I have attached a patch that I think fixes the issue.  Please tell me
>> how to proceed, and what other information you need.
>
> Thanks.
>
> I feel there's something else at work here, because if you move the
> cursor up instead of down (i.e., to the previous instead of the next
> line), the problem doesn't happen.

I see the same hscrolling when moving to the next and to the previous
line, both the same length (too short for hscrolling), see the attached
screenshots.

Steve Berman

[bug#57343-1.png (image/png, attachment)]
[bug#57343-2.png (image/png, attachment)]
[bug#57343-3.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57343; Package emacs. (Tue, 23 Aug 2022 17:08:02 GMT) Full text and rfc822 format available.

Message #14 received at 57343 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: thejofat <at> gmail.com, 57343 <at> debbugs.gnu.org
Subject: Re: bug#57343: hscroll current-line scrolls short lines too far to
 the left
Date: Tue, 23 Aug 2022 20:07:15 +0300
> From: Stephen Berman <stephen.berman <at> gmx.net>
> Cc: Erik van Zwol <thejofat <at> gmail.com>,  57343 <at> debbugs.gnu.org
> Date: Tue, 23 Aug 2022 18:56:34 +0200
> 
> > I feel there's something else at work here, because if you move the
> > cursor up instead of down (i.e., to the previous instead of the next
> > line), the problem doesn't happen.
> 
> I see the same hscrolling when moving to the next and to the previous
> line, both the same length (too short for hscrolling), see the attached
> screenshots.

You are saying that what you see on your system invalidates my
observations on my system?

All I'm saying is that what I see here tells me there's more here than
meets the eye.  AFAIU, your evidence actually affirms my feeling.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57343; Package emacs. (Wed, 24 Aug 2022 03:49:02 GMT) Full text and rfc822 format available.

Message #17 received at 57343 <at> debbugs.gnu.org (full text, mbox):

From: Erik van Zwol <thejofat <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stephen Berman <stephen.berman <at> gmx.net>, 57343 <at> debbugs.gnu.org
Subject: Re: bug#57343: hscroll current-line scrolls short lines too far to
 the left
Date: Tue, 23 Aug 2022 21:48:16 -0600
[Message part 1 (text/plain, inline)]
I believe the issue happens when the line you are moving the cursor from a
line that is hscrolled to a line that is shorter than (frame_width -
hscroll_margin), the issue occurs.  However, if the line you are moving the
cursor to is greater than or equal to (frame_width - hscroll_margin), the
problem does not occur.  This is more evident when you set the
hscroll-margin to something smaller, like 1 or 2.

The patch I attached has modified the if statement that has this condition
in it (point >= frame_width - hscroll_margin) or something like that, I
don't have the code in front of me.



On Tue, Aug 23, 2022 at 11:07 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Stephen Berman <stephen.berman <at> gmx.net>
> > Cc: Erik van Zwol <thejofat <at> gmail.com>,  57343 <at> debbugs.gnu.org
> > Date: Tue, 23 Aug 2022 18:56:34 +0200
> >
> > > I feel there's something else at work here, because if you move the
> > > cursor up instead of down (i.e., to the previous instead of the next
> > > line), the problem doesn't happen.
> >
> > I see the same hscrolling when moving to the next and to the previous
> > line, both the same length (too short for hscrolling), see the attached
> > screenshots.
>
> You are saying that what you see on your system invalidates my
> observations on my system?
>
> All I'm saying is that what I see here tells me there's more here than
> meets the eye.  AFAIU, your evidence actually affirms my feeling.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57343; Package emacs. (Wed, 24 Aug 2022 03:52:02 GMT) Full text and rfc822 format available.

Message #20 received at 57343 <at> debbugs.gnu.org (full text, mbox):

From: Erik van Zwol <thejofat <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stephen Berman <stephen.berman <at> gmx.net>, 57343 <at> debbugs.gnu.org
Subject: Re: bug#57343: hscroll current-line scrolls short lines too far to
 the left
Date: Tue, 23 Aug 2022 21:50:54 -0600
[Message part 1 (text/plain, inline)]
Looking at your screenshots, I believe if you make the bottom line almost
as long as the width of the frame, then the problem would not occur on that
line.

On Tue, Aug 23, 2022 at 9:48 PM Erik van Zwol <thejofat <at> gmail.com> wrote:

> I believe the issue happens when the line you are moving the cursor from a
> line that is hscrolled to a line that is shorter than (frame_width -
> hscroll_margin), the issue occurs.  However, if the line you are moving the
> cursor to is greater than or equal to (frame_width - hscroll_margin), the
> problem does not occur.  This is more evident when you set the
> hscroll-margin to something smaller, like 1 or 2.
>
> The patch I attached has modified the if statement that has this condition
> in it (point >= frame_width - hscroll_margin) or something like that, I
> don't have the code in front of me.
>
>
>
> On Tue, Aug 23, 2022 at 11:07 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> > From: Stephen Berman <stephen.berman <at> gmx.net>
>> > Cc: Erik van Zwol <thejofat <at> gmail.com>,  57343 <at> debbugs.gnu.org
>> > Date: Tue, 23 Aug 2022 18:56:34 +0200
>> >
>> > > I feel there's something else at work here, because if you move the
>> > > cursor up instead of down (i.e., to the previous instead of the next
>> > > line), the problem doesn't happen.
>> >
>> > I see the same hscrolling when moving to the next and to the previous
>> > line, both the same length (too short for hscrolling), see the attached
>> > screenshots.
>>
>> You are saying that what you see on your system invalidates my
>> observations on my system?
>>
>> All I'm saying is that what I see here tells me there's more here than
>> meets the eye.  AFAIU, your evidence actually affirms my feeling.
>>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 218 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.