1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-19 04:20:47 +00:00

Fix positioning after save.

This commit is contained in:
Andrey Kotlarski 2013-04-14 00:53:24 +03:00
parent 6ea7a2aa1e
commit 9fad430601

View File

@ -459,18 +459,18 @@ If changing size of chunk shift remaining file content."
(or (verify-visited-file-modtime) (or (verify-visited-file-modtime)
(y-or-n-p "File has changed since visited or saved. \ (y-or-n-p "File has changed since visited or saved. \
Save anyway? "))) Save anyway? ")))
(let ((size-change (- vlfi-end-pos vlfi-start-pos (let ((pos (point))
(size-change (- vlfi-end-pos vlfi-start-pos
(length (encode-coding-region (length (encode-coding-region
(point-min) (point-max) (point-min) (point-max)
buffer-file-coding-system t)))) buffer-file-coding-system t)))))
(pos (point)))
(cond ((zerop size-change) (cond ((zerop size-change)
(write-region nil nil buffer-file-name vlfi-start-pos t)) (write-region nil nil buffer-file-name vlfi-start-pos t))
((< 0 size-change) ((< 0 size-change)
(vlfi-file-shift-back size-change)) (vlfi-file-shift-back size-change))
(t (vlfi-file-shift-forward (- size-change)))) (t (vlfi-file-shift-forward (- size-change))))
(goto-char pos))
(vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos) (vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos)
(goto-char pos))
(vlfi-mode) (vlfi-mode)
t)) t))