]> git.eshelyaron.com Git - emacs.git/commitdiff
view-search: Start search from beginning or end of line
authorTomas Nordin <tomasn@posteo.net>
Sun, 9 Feb 2025 21:39:58 +0000 (22:39 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 10:24:06 +0000 (11:24 +0100)
* 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

index dc157d8996ac16f6863d90a3cba43601bbbe45e0..3db7d6038bd71dcf99a117b88ddd2d76387d4c0c 100644 (file)
@@ -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))))