branch: externals/vlf
commit ce13609f14033b94669cbb07cbad51857bfaac9e
Author: Andrey Kotlarski <[email protected]>
Commit: Andrey Kotlarski <[email protected]>
Fix vlf-ediff at the borders of hexl buffers.
---
vlf-base.el | 44 ++++++++++++++++++++++----------------------
vlf-ediff.el | 4 ++--
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/vlf-base.el b/vlf-base.el
index 268dcaa..f040f0f 100644
--- a/vlf-base.el
+++ b/vlf-base.el
@@ -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.
diff --git a/vlf-ediff.el b/vlf-ediff.el
index 27f1b05..5c4c161 100644
--- a/vlf-ediff.el
+++ b/vlf-ediff.el
@@ -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