mirror of
https://github.com/m00natic/vlfi.git
synced 2025-01-31 02:00:47 +00:00
Widen region when measuring encoded content length.
This commit is contained in:
parent
88dba8bb25
commit
429a8ff016
@ -106,6 +106,7 @@ bytes added to the 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.
|
||||||
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."
|
||||||
|
(widen)
|
||||||
(let* ((modified (buffer-modified-p))
|
(let* ((modified (buffer-modified-p))
|
||||||
(start (max 0 start))
|
(start (max 0 start))
|
||||||
(end (min end vlf-file-size))
|
(end (min end vlf-file-size))
|
||||||
@ -133,8 +134,8 @@ bytes added to the end."
|
|||||||
(inhibit-read-only t))
|
(inhibit-read-only t))
|
||||||
(cond ((< end edit-end)
|
(cond ((< end edit-end)
|
||||||
(let* ((del-pos (1+ (or (byte-to-position
|
(let* ((del-pos (1+ (or (byte-to-position
|
||||||
(- end vlf-start-pos))
|
(- end vlf-start-pos))
|
||||||
0)))
|
0)))
|
||||||
(del-len (length (encode-coding-region
|
(del-len (length (encode-coding-region
|
||||||
del-pos (point-max)
|
del-pos (point-max)
|
||||||
buffer-file-coding-system
|
buffer-file-coding-system
|
||||||
@ -303,8 +304,8 @@ Return number of bytes added over expected."
|
|||||||
(insert-file-contents-literally buffer-file-name nil start end)
|
(insert-file-contents-literally buffer-file-name nil start end)
|
||||||
(let ((coding-system-for-read coding))
|
(let ((coding-system-for-read coding))
|
||||||
(decode-coding-inserted-region position (point-max)
|
(decode-coding-inserted-region position (point-max)
|
||||||
buffer-file-name nil start end))
|
buffer-file-name nil start end)))
|
||||||
(setq buffer-file-coding-system last-coding-system-used)))
|
(setq buffer-file-coding-system last-coding-system-used))
|
||||||
|
|
||||||
(defun vlf-shift-undo-list (n)
|
(defun vlf-shift-undo-list (n)
|
||||||
"Shift undo list element regions by N."
|
"Shift undo list element regions by N."
|
||||||
|
@ -44,6 +44,7 @@ Save anyway? "))
|
|||||||
buffer-file-truename)
|
buffer-file-truename)
|
||||||
vlf-end-pos vlf-file-size)
|
vlf-end-pos vlf-file-size)
|
||||||
(vlf-update-buffer-name))
|
(vlf-update-buffer-name))
|
||||||
|
(widen)
|
||||||
(let* ((region-length (length (encode-coding-region
|
(let* ((region-length (length (encode-coding-region
|
||||||
(point-min) (point-max)
|
(point-min) (point-max)
|
||||||
buffer-file-coding-system t)))
|
buffer-file-coding-system t)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user