1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-18 12:05:31 +00:00

Fix vlf-ediff at the borders of hexl buffers.

This commit is contained in:
Andrey Kotlarski 2014-10-07 13:20:04 +03:00
parent 673ae08848
commit ce13609f14
2 changed files with 24 additions and 24 deletions

View File

@ -92,28 +92,28 @@ If same as current chunk is requested, do nothing.
Return number of bytes moved back for proper decoding and number of Return number of bytes moved back for proper decoding and number of
bytes added to the end." bytes added to the end."
(vlf-verify-size) (vlf-verify-size)
(if (derived-mode-p 'hexl-mode) (if (or (<= end start) (<= end 0)
(setq start (- start (mod start hexl-bits)) (<= vlf-file-size start))
end (+ end (- hexl-bits (mod end hexl-bits))))) (when (or (not (buffer-modified-p))
(cond ((or (<= end start) (<= end 0) (y-or-n-p "Chunk modified, are you sure? "))
(<= vlf-file-size start)) (erase-buffer)
(when (or (not (buffer-modified-p)) (set-buffer-modified-p nil)
(y-or-n-p "Chunk modified, are you sure? ")) (let ((place (if (<= vlf-file-size start)
(erase-buffer) vlf-file-size
(set-buffer-modified-p nil) 0)))
(let ((place (if (<= vlf-file-size start) (setq vlf-start-pos place
vlf-file-size vlf-end-pos place)
0))) (or minimal (vlf-update-buffer-name))
(setq vlf-start-pos place (cons (- start place) (- place end))))
vlf-end-pos place) (if (derived-mode-p 'hexl-mode)
(or minimal (vlf-update-buffer-name)) (setq start (- start (mod start hexl-bits))
(cons (- start place) (- place end))))) end (+ end (- hexl-bits (mod end hexl-bits)))))
((or (/= start vlf-start-pos) (if (or (/= start vlf-start-pos)
(/= end vlf-end-pos)) (/= end vlf-end-pos))
(let ((shifts (vlf-move-to-chunk-1 start end))) (let ((shifts (vlf-move-to-chunk-1 start end)))
(and shifts (not minimal) (and shifts (not minimal)
(vlf-update-buffer-name)) (vlf-update-buffer-name))
shifts)))) shifts))))
(defun vlf-move-to-chunk-1 (start end) (defun vlf-move-to-chunk-1 (start end)
"Move to chunk enclosed by START END keeping as much edits if any. "Move to chunk enclosed by START END keeping as much edits if any.

View File

@ -217,9 +217,9 @@ logical chunks in case there is no difference at the current ones."
(vlf-move-to-chunk (- max-file-size (vlf-move-to-chunk (- max-file-size
vlf-batch-size) vlf-batch-size)
max-file-size)) max-file-size))
(vlf-beginning-of-file) (vlf-move-to-batch 0)
(set-buffer buffer-A) (set-buffer buffer-A)
(vlf-beginning-of-file)) (vlf-move-to-batch 0))
(set-buffer ediff-buffer) (set-buffer ediff-buffer)
(ediff-update-diffs) (ediff-update-diffs)
(or is-hexl (or is-hexl