unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17823: 24.3.91; end-of-visual-line: incorrect behaviour with truncate-lines and a line-prefix
@ 2014-06-20 17:40 Nicolas Richard
  2014-06-20 18:56 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Richard @ 2014-06-20 17:40 UTC (permalink / raw)
  To: 17823

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.





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

* bug#17823: 24.3.91; end-of-visual-line: incorrect behaviour with truncate-lines and a line-prefix
  2014-06-20 17:40 bug#17823: 24.3.91; end-of-visual-line: incorrect behaviour with truncate-lines and a line-prefix Nicolas Richard
@ 2014-06-20 18:56 ` Eli Zaretskii
  2014-06-20 19:20   ` Stefan Monnier
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eli Zaretskii @ 2014-06-20 18:56 UTC (permalink / raw)
  To: Nicolas Richard; +Cc: 17823

> From: Nicolas Richard <theonewiththeevillook@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.





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

* bug#17823: 24.3.91; end-of-visual-line: incorrect behaviour with truncate-lines and a line-prefix
  2014-06-20 18:56 ` Eli Zaretskii
@ 2014-06-20 19:20   ` Stefan Monnier
  2014-06-20 20:27   ` Nicolas Richard
  2014-06-21 12:36   ` Eli Zaretskii
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2014-06-20 19:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Nicolas Richard, 17823

> 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





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

* bug#17823: 24.3.91; end-of-visual-line: incorrect behaviour with truncate-lines and a line-prefix
  2014-06-20 18:56 ` Eli Zaretskii
  2014-06-20 19:20   ` Stefan Monnier
@ 2014-06-20 20:27   ` Nicolas Richard
  2014-06-21 12:36   ` Eli Zaretskii
  2 siblings, 0 replies; 5+ messages in thread
From: Nicolas Richard @ 2014-06-20 20:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Nicolas Richard, 17823

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Nicolas Richard <theonewiththeevillook@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.





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

* bug#17823: 24.3.91; end-of-visual-line: incorrect behaviour with truncate-lines and a line-prefix
  2014-06-20 18:56 ` Eli Zaretskii
  2014-06-20 19:20   ` Stefan Monnier
  2014-06-20 20:27   ` Nicolas Richard
@ 2014-06-21 12:36   ` Eli Zaretskii
  2 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2014-06-21 12:36 UTC (permalink / raw)
  To: theonewiththeevillook; +Cc: 17823-done

> Date: Fri, 20 Jun 2014 21:56:22 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 17823@debbugs.gnu.org
> 
> > From: Nicolas Richard <theonewiththeevillook@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.





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

end of thread, other threads:[~2014-06-21 12:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-20 17:40 bug#17823: 24.3.91; end-of-visual-line: incorrect behaviour with truncate-lines and a line-prefix Nicolas Richard
2014-06-20 18:56 ` Eli Zaretskii
2014-06-20 19:20   ` Stefan Monnier
2014-06-20 20:27   ` Nicolas Richard
2014-06-21 12:36   ` 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).