GNU bug report logs - #17823
24.3.91; end-of-visual-line: incorrect behaviour with truncate-lines and a line-prefix

Previous Next

Package: emacs;

Reported by: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>

Date: Fri, 20 Jun 2014 17:41:02 UTC

Severity: normal

Found in version 24.3.91

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17823 in the body.
You can then email your comments to 17823 AT debbugs.gnu.org in the normal way.

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#17823; Package emacs. (Fri, 20 Jun 2014 17:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Richard <theonewiththeevillook <at> yahoo.fr>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 20 Jun 2014 17:41:03 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.91;
 end-of-visual-line: incorrect behaviour with truncate-lines and a
 line-prefix
Date: Fri, 20 Jun 2014 19:40:24 +0200
Hi,

from emacs -Q, run the following with M-:

(progn
  (insert (make-string 500 ?x))
  (column-number-mode) ;; just to see it. plays no role.
  (beginning-of-line)
  (setq line-prefix (make-string 10 ? ))
  (visual-line-mode)
  (toggle-truncate-lines 1))

then hit C-e (end-of-visual-line) a few times. After some hits, the
cursor doesn't move anymore, although it's not at the end of the line.
On my machine, it goes to column 70, then 100, then stops there even
when hitting C-e again.

I expect emacs to scroll horizontally instead (like it does when
line-prefix is nil).

-- 
Nicolas.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17823; Package emacs. (Fri, 20 Jun 2014 18:57:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Cc: 17823 <at> debbugs.gnu.org
Subject: Re: bug#17823: 24.3.91;
 end-of-visual-line: incorrect behaviour with truncate-lines and
 a	line-prefix
Date: Fri, 20 Jun 2014 21:56:22 +0300
> From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
> Date: Fri, 20 Jun 2014 19:40:24 +0200
> 
> (progn
>   (insert (make-string 500 ?x))
>   (column-number-mode) ;; just to see it. plays no role.
>   (beginning-of-line)
>   (setq line-prefix (make-string 10 ? ))
>   (visual-line-mode)
>   (toggle-truncate-lines 1))
> 
> then hit C-e (end-of-visual-line) a few times. After some hits, the
> cursor doesn't move anymore, although it's not at the end of the line.
> On my machine, it goes to column 70, then 100, then stops there even
> when hitting C-e again.
> 
> I expect emacs to scroll horizontally instead

Why do you expect that?  "Visual line" means the line that is on
display.  What isn't on display does not exist for this purpose.

Is there some real-life use case behind this?  If so, please show it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17823; Package emacs. (Fri, 20 Jun 2014 19:22:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>, 17823 <at> debbugs.gnu.org
Subject: Re: bug#17823: 24.3.91; end-of-visual-line: incorrect behaviour with
 truncate-lines and a	line-prefix
Date: Fri, 20 Jun 2014 15:20:54 -0400
> Why do you expect that?  "Visual line" means the line that is on
> display.  What isn't on display does not exist for this purpose.

Hmm... good point.  My intuitive understanding of the "visual line"
feature is to distinguish the "newlines" from the "line wraps", so when
we `truncate-lines' I'd expect the visual-line movements to be the same
as the physical line movements (tho I'd allow a distinction in the case
of line-wraps introduced via `display' of before/after-strings).


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17823; Package emacs. (Fri, 20 Jun 2014 20:28:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>, 17823 <at> debbugs.gnu.org
Subject: Re: bug#17823: 24.3.91;
 end-of-visual-line: incorrect behaviour with truncate-lines and
 a	line-prefix
Date: Fri, 20 Jun 2014 22:27:06 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
>> Date: Fri, 20 Jun 2014 19:40:24 +0200
>> 
>> (progn
>>   (insert (make-string 500 ?x))
>>   (column-number-mode) ;; just to see it. plays no role.
>>   (beginning-of-line)
>>   (setq line-prefix (make-string 10 ? ))
>>   (visual-line-mode)
>>   (toggle-truncate-lines 1))
>> 
>> then hit C-e (end-of-visual-line) a few times. After some hits, the
>> cursor doesn't move anymore, although it's not at the end of the line.
>> On my machine, it goes to column 70, then 100, then stops there even
>> when hitting C-e again.
>> 
>> I expect emacs to scroll horizontally instead
>
> Why do you expect that?

Because when the cursor is near the right border of the window (~ 5
characters), emacs scrolls horizontally automatically (depending on
auto-hscroll-mode). Since the end of the visual line is at the right
border of the window, emacs should put cursor there and scroll
accordingly. It does it correctly when line-prefix is nil. In the recipe
I gave, C-e fails to place point at the right border of the window.

> Is there some real-life use case behind this?  If so, please show it.

My use case is an org mode file like

* title
** title2
*** title3
| some | very | wide | org | mode | table | some | very | wide | org | mode | table | some | very | wide | org | mode | table | some | very | wide | org | mode | table | some | very | wide | org | mode | table | some | very | wide | org | mode | table | 

when org-indent-mode is activated (which adds line-prefix) and
visual-line-mode activated. If the table is very wide, it'll be wrapped
and look bad. So I toggle-truncate-lines temporarily to avoid the
wrapping, and can navigate through the table by (horizontal)
screenfuls... except for the bug.

The workaround in my use case is to temporarily turn off
visual-line-mode instead of temporarily activating truncate-lines ; but
nevertheless I think there's a bug in vertical-motion : (vertical-motion
(cons (window-width) 0)) fails to set the point at the correct position
when asked to.

-- 
Nico.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 21 Jun 2014 12:38:03 GMT) Full text and rfc822 format available.

Notification sent to Nicolas Richard <theonewiththeevillook <at> yahoo.fr>:
bug acknowledged by developer. (Sat, 21 Jun 2014 12:38:04 GMT) Full text and rfc822 format available.

Message #19 received at 17823-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: theonewiththeevillook <at> yahoo.fr
Cc: 17823-done <at> debbugs.gnu.org
Subject: Re: bug#17823: 24.3.91;
 end-of-visual-line: incorrect behaviour with truncate-lines
 and	a	line-prefix
Date: Sat, 21 Jun 2014 15:36:52 +0300
> Date: Fri, 20 Jun 2014 21:56:22 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 17823 <at> debbugs.gnu.org
> 
> > From: Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
> > Date: Fri, 20 Jun 2014 19:40:24 +0200
> > 
> > (progn
> >   (insert (make-string 500 ?x))
> >   (column-number-mode) ;; just to see it. plays no role.
> >   (beginning-of-line)
> >   (setq line-prefix (make-string 10 ? ))
> >   (visual-line-mode)
> >   (toggle-truncate-lines 1))
> > 
> > then hit C-e (end-of-visual-line) a few times. After some hits, the
> > cursor doesn't move anymore, although it's not at the end of the line.
> > On my machine, it goes to column 70, then 100, then stops there even
> > when hitting C-e again.
> > 
> > I expect emacs to scroll horizontally instead
> 
> Why do you expect that?  "Visual line" means the line that is on
> display.  What isn't on display does not exist for this purpose.
> 
> Is there some real-life use case behind this?  If so, please show it.

Actually, no, don't bother.  I found out that this was due to the
original code in vertical-motion being incorrect due to some subtle
aspect of the display engine which the code ignored.

Fixed in revision 117277 on the emacs-24 branch.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 20 Jul 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 293 days ago.

Previous Next


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