1
0
mirror of https://github.com/m00natic/vlfi.git synced 2024-10-05 18:30:51 +01: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
bytes added to the end."
(vlf-verify-size)
(if (derived-mode-p 'hexl-mode)
(setq start (- start (mod start hexl-bits))
end (+ end (- hexl-bits (mod end hexl-bits)))))
(cond ((or (<= end start) (<= end 0)
(<= vlf-file-size start))
(when (or (not (buffer-modified-p))
(y-or-n-p "Chunk modified, are you sure? "))
(erase-buffer)
(set-buffer-modified-p nil)
(let ((place (if (<= vlf-file-size start)
vlf-file-size
0)))
(setq vlf-start-pos place
vlf-end-pos place)
(or minimal (vlf-update-buffer-name))
(cons (- start place) (- place end)))))
((or (/= start vlf-start-pos)
(/= end vlf-end-pos))
(let ((shifts (vlf-move-to-chunk-1 start end)))
(and shifts (not minimal)
(vlf-update-buffer-name))
shifts))))
(if (or (<= end start) (<= end 0)
(<= vlf-file-size start))
(when (or (not (buffer-modified-p))
(y-or-n-p "Chunk modified, are you sure? "))
(erase-buffer)
(set-buffer-modified-p nil)
(let ((place (if (<= vlf-file-size start)
vlf-file-size
0)))
(setq vlf-start-pos place
vlf-end-pos place)
(or minimal (vlf-update-buffer-name))
(cons (- start place) (- place end))))
(if (derived-mode-p 'hexl-mode)
(setq start (- start (mod start hexl-bits))
end (+ end (- hexl-bits (mod end hexl-bits)))))
(if (or (/= start vlf-start-pos)
(/= end vlf-end-pos))
(let ((shifts (vlf-move-to-chunk-1 start end)))
(and shifts (not minimal)
(vlf-update-buffer-name))
shifts))))
(defun vlf-move-to-chunk-1 (start end)
"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-batch-size)
max-file-size))
(vlf-beginning-of-file)
(vlf-move-to-batch 0)
(set-buffer buffer-A)
(vlf-beginning-of-file))
(vlf-move-to-batch 0))
(set-buffer ediff-buffer)
(ediff-update-diffs)
(or is-hexl