1
0
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:
Andrey Kotlarski 2014-01-11 19:00:00 +02:00
parent 88dba8bb25
commit 429a8ff016
2 changed files with 6 additions and 4 deletions

View File

@ -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))
@ -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."

View File

@ -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)))