mirror of
				https://github.com/m00natic/vlfi.git
				synced 2025-10-30 22:53:37 +00:00 
			
		
		
		
	Add adjust command for cases where chunk starts with part of multibyte symbol.
This commit is contained in:
		
							
								
								
									
										14
									
								
								vlfi.el
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								vlfi.el
									
									
									
									
									
								
							| @@ -67,6 +67,7 @@ | |||||||
|     (define-key map "e" 'vlfi-edit-mode) |     (define-key map "e" 'vlfi-edit-mode) | ||||||
|     (define-key map "j" 'vlfi-jump-to-chunk) |     (define-key map "j" 'vlfi-jump-to-chunk) | ||||||
|     (define-key map "l" 'vlfi-goto-line) |     (define-key map "l" 'vlfi-goto-line) | ||||||
|  |     (define-key map "a" 'vlfi-adjust-chunk) | ||||||
|     map) |     map) | ||||||
|   "Keymap for `vlfi-mode'.") |   "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) |         (vlfi-move-to-chunk start-pos end-pos) | ||||||
|         (goto-char 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 | ;;; editing | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user