bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#1730: 23.0.60; line-move-visual doesn't forget


From: Lennart Borgman (gmail)
Subject: bug#1730: 23.0.60; line-move-visual doesn't forget
Date: Mon, 29 Dec 2008 23:55:23 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

It looks like line-move-visual keeps remember too much about which
column it was in. To show that start from

  emacs -Q

and eval this code

(defun ourcomments-move-beginning-of-line(arg)
  "Move point to beginning of line or indentation.
See `beginning-of-line' for ARG.

If `line-move-visual' is on then the visual line beginning is
first tried."
  (interactive "p")
  (let ((pos (point))
        vis-pos)
    (when line-move-visual
      (line-move-visual -1 t)
      (beginning-of-line)
      (setq vis-pos (point))
      (goto-char pos))
    (call-interactively 'beginning-of-line arg)
    (when (and vis-pos
               (= vis-pos (point)))
      (while (and (> pos (point))
                  (not (eobp)))
        (line-move-visual 1 t))
      (line-move-visual -1 t))
    (when (= pos (point))
      (if (= 0 (current-column))
          (skip-chars-forward " \t")
        (backward-char)
        (beginning-of-line)))))

(global-set-key [home] 'ourcomments-move-beginning-of-line)

The function is supposed to go to the beginning of the visual line
first. This fails sometimes, see below.

- Shrink the window width so that some lines wrap.
- Go to a wrapped buffer line, to the first visual line of it.
- Move forward some columns on that line.
- Move down to next visual line (arrow down). You should still be on the
same buffer line.
- Press HOME.

Point should now be on the beginning on the visual line where you
pressed HOME. However it is on the line above instead, on the column you
were before you pressed arrow down.

Now do exactly the same except:

- Before pressing HOME press arrow left followed by arrow right.

Now after pressing HOME you should be on the beginning of the visual
line as expected.


In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2008-12-25
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags
-Ic:/g/include -fno-crossjumping'







reply via email to

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