Mercurial > emacs
changeset 80339:448b3f1d280a
(diff-end-of-hunk): Be careful not to overlook trailing
"+" lines not accounted for by counting "-" and context lines.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 18 Mar 2008 20:49:52 +0000 |
parents | 28af19e6b167 |
children | 756c7bbc9664 |
files | lisp/ChangeLog lisp/diff-mode.el |
diffstat | 2 files changed, 21 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Mon Mar 17 23:34:55 2008 +0000 +++ b/lisp/ChangeLog Tue Mar 18 20:49:52 2008 +0000 @@ -1,11 +1,16 @@ +2008-03-18 Stefan Monnier <monnier@iro.umontreal.ca> + + * diff-mode.el (diff-end-of-hunk): Be careful not to overlook trailing + "+" lines not accounted for by counting "-" and context lines. + 2008-03-16 Juri Linkov <juri@jurta.org> * dired.el (dired-warn-writable): Rename to `dired-perm-write'. - (dired-perm-write): Renamed from `dired-warn-writable'. + (dired-perm-write): Rename from `dired-warn-writable'. Change parent face from `font-lock-warning-face' to `font-lock-comment-delimiter-face'. (dired-warn-writable-face): Rename to `dired-perm-write-face'. - (dired-perm-write-face): Renamed from `dired-warn-writable-face'. + (dired-perm-write-face): Rename from `dired-warn-writable-face'. (dired-font-lock-keywords): Replace `dired-warn-writable-face' with `dired-perm-write-face'.
--- a/lisp/diff-mode.el Mon Mar 17 23:34:55 2008 +0000 +++ b/lisp/diff-mode.el Tue Mar 18 20:49:52 2008 +0000 @@ -402,12 +402,23 @@ (setq style (cdr (assq (char-after) '((?@ . unified) (?* . context)))))) (goto-char (match-end 0)) (when (and (not donttrustheader) (match-end 2)) + (let* ((nold (string-to-number (match-string 2))) + (nnew (string-to-number (match-string 4))) + (endold (save-excursion (re-search-forward (if diff-valid-unified-empty-line "^[- \n]" "^[- ]") - nil t - (string-to-number (match-string 2))) - (setq end (line-beginning-position 2))))) + nil t nold) + (line-beginning-position 2))) + (endnew + ;; The hunk may end with a bunch of "+" lines, so the `end' is + ;; then further than computed above. + (save-excursion + (re-search-forward (if diff-valid-unified-empty-line + "^[+ \n]" "^[+ ]") + nil t nnew) + (line-beginning-position 2)))) + (setq end (max endold endnew))))) ;; We may have a first evaluation of `end' thanks to the hunk header. (unless end (setq end (and (re-search-forward