1
0
mirror of https://github.com/m00natic/vlfi.git synced 2025-01-18 12:05:31 +00:00

Forbid short-cutting in line search.

This commit is contained in:
Andrey Kotlarski 2014-12-13 18:41:14 +02:00
parent bd5f9ca6fe
commit f4526a1492

View File

@ -256,19 +256,19 @@ Search is performed chunk by chunk in `vlf-batch-size' memory."
(inhibit-read-only t)) (inhibit-read-only t))
(setq n (1- n)) (setq n (1- n))
(vlf-with-undo-disabled (vlf-with-undo-disabled
(while (and (< (- end start) n) ;; (while (and (< (- end start) n)
(< n (- vlf-file-size start))) ;; (< n (- vlf-file-size start)))
(erase-buffer) ;; (erase-buffer)
(vlf-tune-insert-file-contents-literally start end) ;; (vlf-tune-insert-file-contents-literally start end)
(goto-char (point-min)) ;; (goto-char (point-min))
(while (re-search-forward "[\n\C-m]" nil t) ;; (while (re-search-forward "[\n\C-m]" nil t)
(setq n (1- n))) ;; (setq n (1- n)))
(vlf-verify-size) ;; (vlf-verify-size)
(vlf-tune-batch '(:raw)) ;; (vlf-tune-batch '(:raw))
(setq start end ;; (setq start end
end (min vlf-file-size (+ start ;; end (min vlf-file-size (+ start
vlf-batch-size))) ;; vlf-batch-size)))
(progress-reporter-update reporter start)) ;; (progress-reporter-update reporter start))
(when (< n (- vlf-file-size end)) (when (< n (- vlf-file-size end))
(vlf-tune-batch '(:insert :encode)) (vlf-tune-batch '(:insert :encode))
(vlf-move-to-chunk-2 start (+ start vlf-batch-size)) (vlf-move-to-chunk-2 start (+ start vlf-batch-size))
@ -278,8 +278,7 @@ Search is performed chunk by chunk in `vlf-batch-size' memory."
(when (vlf-re-search "[\n\C-m]" n nil 0 (when (vlf-re-search "[\n\C-m]" n nil 0
reporter time) reporter time)
(forward-char) t)))))) (forward-char) t))))))
(let ((start (max 0 (- vlf-file-size vlf-batch-size))) (let ((end vlf-file-size)
(end vlf-file-size)
(reporter (make-progress-reporter (reporter (make-progress-reporter
(concat "Searching for line -" (concat "Searching for line -"
(number-to-string n) "...") (number-to-string n) "...")
@ -287,17 +286,18 @@ Search is performed chunk by chunk in `vlf-batch-size' memory."
(inhibit-read-only t)) (inhibit-read-only t))
(setq n (- n)) (setq n (- n))
(vlf-with-undo-disabled (vlf-with-undo-disabled
(while (and (< (- end start) n) (< n end)) ;; (let ((start (max 0 (- vlf-file-size vlf-batch-size))))
(erase-buffer) ;; (while (and (< (- end start) n) (< n end))
(vlf-tune-insert-file-contents-literally start end) ;; (erase-buffer)
(goto-char (point-max)) ;; (vlf-tune-insert-file-contents-literally start end)
(while (re-search-backward "[\n\C-m]" nil t) ;; (goto-char (point-max))
(setq n (1- n))) ;; (while (re-search-backward "[\n\C-m]" nil t)
(vlf-tune-batch '(:raw)) ;; (setq n (1- n)))
(setq end start ;; (vlf-tune-batch '(:raw))
start (max 0 (- end vlf-batch-size))) ;; (setq end start
(progress-reporter-update reporter ;; start (max 0 (- end vlf-batch-size)))
(- vlf-file-size end))) ;; (progress-reporter-update reporter
;; (- vlf-file-size end))))
(when (< n end) (when (< n end)
(vlf-tune-batch '(:insert :encode)) (vlf-tune-batch '(:insert :encode))
(vlf-move-to-chunk-2 (- end vlf-batch-size) end) (vlf-move-to-chunk-2 (- end vlf-batch-size) end)