mirror of
https://github.com/m00natic/vlfi.git
synced 2025-01-31 02:00:47 +00:00
Add adjust command for cases where chunk starts with part of multibyte symbol.
This commit is contained in:
parent
74febeb183
commit
473536e050
14
vlfi.el
14
vlfi.el
@ -67,6 +67,7 @@
|
||||
(define-key map "e" 'vlfi-edit-mode)
|
||||
(define-key map "j" 'vlfi-jump-to-chunk)
|
||||
(define-key map "l" 'vlfi-goto-line)
|
||||
(define-key map "a" 'vlfi-adjust-chunk)
|
||||
map)
|
||||
"Keymap for `vlfi-mode'.")
|
||||
|
||||
@ -460,6 +461,19 @@ Search is performed chunk by chunk in `vlfi-batch-size' memory."
|
||||
(vlfi-move-to-chunk start-pos end-pos)
|
||||
(goto-char pos)))))
|
||||
|
||||
(defun vlfi-adjust-chunk (bytes)
|
||||
"Adjust chunk beginning by BYTES."
|
||||
(interactive "p")
|
||||
(or (zerop vlfi-start-pos)
|
||||
(let ((pos (+ (point) bytes)))
|
||||
(setq vlfi-start-pos (- vlfi-start-pos bytes))
|
||||
(let ((inhibit-read-only t))
|
||||
(erase-buffer)
|
||||
(insert-file-contents buffer-file-name nil
|
||||
vlfi-start-pos vlfi-end-pos))
|
||||
(set-buffer-modified-p nil)
|
||||
(goto-char pos))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; editing
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user