From 9beee01558e2cc34c1114ee7582b66b43a4afd71 Mon Sep 17 00:00:00 2001 From: Tomas Nordin Date: Sun, 9 Feb 2025 22:39:58 +0100 Subject: [PATCH] view-search: Start search from beginning or end of line * lisp/view.el (view-search): Go to beginning-of-line or end-of-line instead of previous or next line before the search. (Bug#76167) (cherry picked from commit e35435daf392462440bbc51a5b82d93eea7757c6) --- lisp/view.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/view.el b/lisp/view.el index dc157d8996a..3db7d6038bd 100644 --- a/lisp/view.el +++ b/lisp/view.el @@ -885,7 +885,9 @@ for highlighting the match that is found." (t (error "No previous View-mode search"))) (save-excursion (if end (goto-char (if (< times 0) (point-max) (point-min))) - (forward-line (if (< times 0) -1 1))) + (if (< times 0) + (beginning-of-line) + (end-of-line))) (if (if no (view-search-no-match-lines times regexp) (re-search-forward regexp nil t times)) (setq where (point)))) -- 2.39.5