comparison lisp/allout.el @ 112119:48f5ac42611a

Reconcile with changes in line movement behavior for long text lines that cross more than a single physical window line, ie when truncate-lines is nil. (allout-next-visible-heading): Provide for change in line-move behavior on long lines when truncate-lines is nil. In that case, line-move can wind up on the same textual line when it moves to the next window line, and moving to the bullet position after the move yields zero advancement. Add logic to detect and compensate for the lack of progress. (allout-current-topic-collapsed-p): move-end-of-line respect for field boundaries is different when operating with body lines shorter than window width versus ones greater than window width, which can yield false negatives in this function. Avoid difference by applying move-end-of-line while field-text-motion is inhibited.
author Ken Manheimer <ken.manheimer@gmail.com>
date Tue, 04 Jan 2011 14:44:10 -0500
parents 38481fb0a538
children 5a83a0764cb0
comparison
equal deleted inserted replaced
112118:f6e033582333 112119:48f5ac42611a
3325 3325
3326 (interactive "p") 3326 (interactive "p")
3327 (let* ((inhibit-field-text-motion t) 3327 (let* ((inhibit-field-text-motion t)
3328 (backward (if (< arg 0) (setq arg (* -1 arg)))) 3328 (backward (if (< arg 0) (setq arg (* -1 arg))))
3329 (step (if backward -1 1)) 3329 (step (if backward -1 1))
3330 (progress (allout-current-bullet-pos))
3330 prev got) 3331 prev got)
3331 3332
3332 (while (> arg 0) 3333 (while (> arg 0)
3333 (while (and 3334 (while (and
3334 ;; Boundary condition: 3335 ;; Boundary condition:
3335 (not (if backward (bobp)(eobp))) 3336 (not (if backward (bobp)(eobp)))
3336 ;; Move, skipping over all concealed lines in one fell swoop: 3337 ;; Move, skipping over all concealed lines in one fell swoop:
3337 (prog1 (condition-case nil (or (line-move step) t) 3338 (prog1 (condition-case nil (or (line-move step) t)
3338 (error nil)) 3339 (error nil))
3339 (allout-beginning-of-current-line)) 3340 (allout-beginning-of-current-line)
3341 ;; line-move can wind up on the same line if long.
3342 ;; when moving forward, that would yield no-progress
3343 (when (and (not backward)
3344 (<= (point) progress))
3345 ;; ensure progress by doing line-move from end-of-line:
3346 (end-of-line)
3347 (condition-case nil (or (line-move step) t)
3348 (error nil))
3349 (allout-beginning-of-current-line)
3350 (setq progress (point))))
3340 ;; Deal with apparent header line: 3351 ;; Deal with apparent header line:
3341 (save-match-data 3352 (save-match-data
3342 (if (not (looking-at allout-regexp)) 3353 (if (not (looking-at allout-regexp))
3343 ;; not a header line, keep looking: 3354 ;; not a header line, keep looking:
3344 t 3355 t
5072 (save-match-data 5083 (save-match-data
5073 (save-excursion 5084 (save-excursion
5074 (and 5085 (and
5075 ;; Is the topic all on one line (allowing for trailing blank line)? 5086 ;; Is the topic all on one line (allowing for trailing blank line)?
5076 (>= (progn (allout-back-to-current-heading) 5087 (>= (progn (allout-back-to-current-heading)
5077 (move-end-of-line 1) 5088 (let ((inhibit-field-text-motion t))
5089 (move-end-of-line 1))
5078 (point)) 5090 (point))
5079 (allout-end-of-current-subtree (not (looking-at "\n\n")))) 5091 (allout-end-of-current-subtree (not (looking-at "\n\n"))))
5080 5092
5081 (or include-single-liners 5093 (or include-single-liners
5082 (progn (backward-char 1) (allout-hidden-p))))))) 5094 (progn (backward-char 1) (allout-hidden-p)))))))