mirror of
https://github.com/m00natic/vlfi.git
synced 2025-01-31 02:00:47 +00:00
Skip adjustment in some cases of overlapping chunk.
This commit is contained in:
parent
9510c70860
commit
a71ee32508
34
vlf-base.el
34
vlf-base.el
@ -146,26 +146,39 @@ bytes added to the end."
|
|||||||
(shift-end 0))
|
(shift-end 0))
|
||||||
(let ((pos (+ (position-bytes (point)) vlf-start-pos))
|
(let ((pos (+ (position-bytes (point)) vlf-start-pos))
|
||||||
(inhibit-read-only t))
|
(inhibit-read-only t))
|
||||||
(cond ((< end edit-end)
|
(cond ((= end vlf-start-pos)
|
||||||
|
(or (eq buffer-undo-list t)
|
||||||
|
(setq buffer-undo-list nil))
|
||||||
|
(vlf-with-undo-disabled (erase-buffer))
|
||||||
|
(setq modified nil))
|
||||||
|
((< end edit-end)
|
||||||
(setq end (car (vlf-delete-region
|
(setq end (car (vlf-delete-region
|
||||||
(point-min) vlf-start-pos edit-end
|
(point-min) vlf-start-pos edit-end
|
||||||
end (or (byte-to-position
|
end (min (or (byte-to-position
|
||||||
(- end vlf-start-pos))
|
(- end vlf-start-pos))
|
||||||
(point-min))
|
(point-min))
|
||||||
|
(point-max))
|
||||||
nil))))
|
nil))))
|
||||||
((< edit-end end)
|
((< edit-end end)
|
||||||
(vlf-with-undo-disabled
|
(vlf-with-undo-disabled
|
||||||
(setq shift-end (cdr (vlf-insert-file-contents
|
(setq shift-end (cdr (vlf-insert-file-contents
|
||||||
vlf-end-pos end
|
vlf-end-pos end nil t
|
||||||
(/= start vlf-end-pos) t
|
|
||||||
(point-max)))))))
|
(point-max)))))))
|
||||||
(setq vlf-end-pos (+ end shift-end))
|
(setq vlf-end-pos (+ end shift-end))
|
||||||
(cond ((< vlf-start-pos start)
|
(cond ((= start edit-end)
|
||||||
|
(or (eq buffer-undo-list t)
|
||||||
|
(setq buffer-undo-list nil))
|
||||||
|
(vlf-with-undo-disabled
|
||||||
|
(delete-region (point-min) (point)))
|
||||||
|
(setq modified nil))
|
||||||
|
((< vlf-start-pos start)
|
||||||
(let ((del-info (vlf-delete-region
|
(let ((del-info (vlf-delete-region
|
||||||
(point-min) vlf-start-pos
|
(point-min) vlf-start-pos
|
||||||
vlf-end-pos start
|
vlf-end-pos start
|
||||||
(byte-to-position
|
(min (or (byte-to-position
|
||||||
(- start vlf-start-pos)) t)))
|
(- start vlf-start-pos))
|
||||||
|
(point))
|
||||||
|
(point-max)) t)))
|
||||||
(setq start (car del-info))
|
(setq start (car del-info))
|
||||||
(vlf-shift-undo-list (- (point-min)
|
(vlf-shift-undo-list (- (point-min)
|
||||||
(cdr del-info)))))
|
(cdr del-info)))))
|
||||||
@ -173,8 +186,7 @@ bytes added to the end."
|
|||||||
(let ((edit-end-pos (point-max)))
|
(let ((edit-end-pos (point-max)))
|
||||||
(vlf-with-undo-disabled
|
(vlf-with-undo-disabled
|
||||||
(setq shift-start (car (vlf-insert-file-contents
|
(setq shift-start (car (vlf-insert-file-contents
|
||||||
start vlf-start-pos t
|
start vlf-start-pos t nil
|
||||||
(/= end vlf-start-pos)
|
|
||||||
edit-end-pos)))
|
edit-end-pos)))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(insert (delete-and-extract-region
|
(insert (delete-and-extract-region
|
||||||
|
Loading…
x
Reference in New Issue
Block a user