emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hl-line and visual-line


From: Eli Zaretskii
Subject: Re: Hl-line and visual-line
Date: Fri, 21 May 2010 00:02:34 +0300

> From: David Reitter <address@hidden>
> Date: Thu, 20 May 2010 16:30:59 -0400
> 
> +(defun visual-line-line-range ()
> +  (save-excursion
> +    (cons (progn (vertical-motion 0) (point))
> +         (progn (vertical-motion 1) (point)))))

This will do The Wrong Thing with bidirectional text, because
vertical-motion puts you on column zero, which is not necessarily the
first character after a newline, in buffer's order of increasing
character positions (a.k.a. "logical order").  The net effect will be
that only part of the screen line will be highlighted.

I just yesterday fixed a similar problem in move-end-of-line (see
revno 100369).  You need to proactively get to the line's first
character, with either skip-chars-backward or (per Stefan's
suggestion) `(forward-line 0)'.

Morale: in Emacs 24, we need to unlearn the seemingly obvious
assumption that the first character at the window margin always
follows the newline of the previous line.  It is no longer true.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]