auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] TeX-fold problem


From: Tassilo Horn
Subject: Re: [AUCTeX] TeX-fold problem
Date: Mon, 19 Nov 2012 13:36:13 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Joost Kremers <address@hidden> writes:

Hi Joost,

> Try the same with a regular paragraph of text in which e.g. a footnote
> is folded.  Put the cursor directly above the first position of the
> folded text (i.e., on the line above it) and move down.

Oh, indeed.  When I move down on the visual line directly above the
folded footnote, point is displayed on the leading [ afterwards, and
another <down> makes point jump up two visual lines again.

I've debugged the relevant functions, and it looks to me that the
function `vertical-motion' doesn't work as expected.  That's the
function that does the jump back.

,----[ C-h f vertical-motion RET ]
| vertical-motion is a built-in function in `C source code'.
| 
| (vertical-motion LINES &optional WINDOW)
| 
| Move point to start of the screen line LINES lines down.
| If LINES is negative, this means moving up.
| 
| This function is an ordinary cursor motion function
| which calculates the new position based on how text would be displayed.
| The new position may be the start of a line,
| or just the start of a continuation line.
| The function returns number of screen lines moved over;
| that usually equals LINES, but may be closer to zero
| if beginning or end of buffer was reached.
| 
| The optional second argument WINDOW specifies the window to use for
| parameters such as width, horizontal scrolling, and so on.
| The default is to use the selected window's parameters.
| 
| LINES can optionally take the form (COLS . LINES), in which case
| the motion will not stop at the start of a screen line but on
| its column COLS (if such exists on that line, that is).
| 
| [...]
`----

In the example above, it gets called like

    (vertical-motion '(32.0 . 1))

with the meaning "move point vertically by 1 line and stop at column
32."  It also returns 1, but in fact point moved 3 visual lines up, so
it should have returned -3...

I think the problem is that in the line with the folded footnote, the
column 32 is already part of the folded text, i.e., it has a display
property with value "[f]".

I don't think it's an AUCTeX problem.  Here's a recipe how to reproduce
the problem without it.

  1. emacs -Q
  2. Create some test buffer: C-x b foo RET
  3. Evaluate the following using M-:

--8<---------------cut here---------------start------------->8---
(progn
  (visual-line-mode 1)
  (insert "\n\nbla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla")
  (insert (propertize "bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla" 'display "[folded]" 'face 'bold))
  (insert "bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla 
bla bla bla bla bla bla bla bla"))
--8<---------------cut here---------------end--------------->8---

  4. Try to move point vertically thru the "[folded]" text.  When I do
     that from above, point jumps one line back again.  When I do it
     from below, point jumps to the beginning of the complete paragraph.

I'll write a bug report and link to it from here in a minute.

Bye,
Tassilo




reply via email to

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