1
0
mirror of https://github.com/m00natic/vlfi.git synced 2024-10-05 18:30:51 +01:00

Encode smaller region to detect cut point overall offset in vlf-occur

when moving to next batch and be more precise with hexl-mode active.
This commit is contained in:
Andrey Kotlarski 2014-12-27 02:27:18 +02:00
parent bc398d6053
commit b300137941
2 changed files with 15 additions and 9 deletions

View File

@ -375,6 +375,14 @@ which deletion was performed."
(delete-region cut-point (point-max)))) (delete-region cut-point (point-max))))
(cons dist (1+ cut-point)))) (cons dist (1+ cut-point))))
(defun vlf-byte-position (point)
"Determine global byte position of POINT."
(let ((pmax (point-max)))
(if (< (/ pmax 2) point)
(- vlf-end-pos (vlf-tune-encode-length (min (1+ point) pmax)
pmax))
(+ vlf-start-pos (vlf-tune-encode-length (point-min) point)))))
(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."
(or (null buffer-undo-list) (eq buffer-undo-list t) (or (null buffer-undo-list) (eq buffer-undo-list t)

View File

@ -309,7 +309,8 @@ Prematurely ending indexing will still show what's found so far."
match-end-point))))) match-end-point)))))
(- vlf-end-pos (* (- 10 (forward-line 10)) (- vlf-end-pos (* (- 10 (forward-line 10))
hexl-bits))) hexl-bits)))
(let* ((batch-step (min 1024 (/ vlf-batch-size (let* ((pmax (point-max))
(batch-step (min 1024 (/ vlf-batch-size
10))) 10)))
(batch-point (batch-point
(max match-end-point (max match-end-point
@ -317,7 +318,7 @@ Prematurely ending indexing will still show what's found so far."
(byte-to-position (byte-to-position
(- vlf-batch-size batch-step)) (- vlf-batch-size batch-step))
(progn (progn
(goto-char (point-max)) (goto-char pmax)
(let ((last (line-beginning-position))) (let ((last (line-beginning-position)))
(if (= last (point-min)) (if (= last (point-min))
(1- (point)) (1- (point))
@ -334,15 +335,12 @@ Prematurely ending indexing will still show what's found so far."
(goto-char match-end-point) (goto-char match-end-point)
(forward-line) (forward-line)
(setq first-line-incomplete (setq first-line-incomplete
(let ((pmax (point-max))) (if (= (point) pmax)
(if (= (point) pmax) (- pmax match-end-point)))
(- pmax match-end-point)))) (vlf-byte-position batch-point)))))
(+ vlf-start-pos
(vlf-tune-encode-length (point-min)
batch-point))))))
(vlf-tune-batch tune-types) (vlf-tune-batch tune-types)
(setq vlf-end-pos start) ;not to adjust start (setq vlf-end-pos start) ;not to adjust start
(vlf-move-to-chunk-2 start (+ start vlf-batch-size))) (vlf-move-to-chunk start (+ start vlf-batch-size)))
(setq match-start-point (point-min) (setq match-start-point (point-min)
match-end-point match-start-point) match-end-point match-start-point)
(goto-char match-end-point) (goto-char match-end-point)