all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#19353: 25.0.50; Lazy Highlighting
@ 2014-12-11 21:12 Dani Moncayo
  2014-12-12  0:18 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Dani Moncayo @ 2014-12-11 21:12 UTC (permalink / raw
  To: 19353

Recipe:
0. emacs -Q
1. Create and empty buffer.
2. Write there this text (without the hyphen lines):
--------------
fat cat path
too book cool
--------------
3. Place point just after the "a" in "path".
4. Type: C-s a t

Here, the "at" in "path" is not highlighted at all.  Wrong: it should
be lazy-highlighted because it's one match of the current search
string, that can be reached by repeating "C-s".  This bug becomes more
obvious if you type "C-s" several times at this moment.

5. Place point just after the first "o" in "cool".
6. Type: C-s o o

This second scenario is similar: the "oo" in "cool" should be
lazy-highlighted, because it's a match.  Well, in this case the second
"o" in "cool" cannot be (and is not) lazy-highlighted because it's the
current (partial) match, and the Isearch face must take precedence
over the lazy-highlighting.  But still, the first "o" in "cool" should
be lazy-highlighted.

Now type another "C-s", and you will see:
* The "oo" in "too" highlighted as the current match (correct).
* The "oo" in "book" lazy-highlighted (correct).
* The "oo" in "cool" not highlighted (wrong: should be
  lazy-highlighted).



In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
 of 2014-11-30 on LEG570
Repository revision: 3517da701ea5d16c296745d6678988b06bee615d
Windowing system distributor `Microsoft Corp.', version 6.3.9600
Configured using:
 `configure --without-dbus --enable-checking=yes,glyphs
 CPPFLAGS=-DGLYPH_DEBUG=1'


-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#19353: 25.0.50; Lazy Highlighting
  2014-12-11 21:12 bug#19353: 25.0.50; Lazy Highlighting Dani Moncayo
@ 2014-12-12  0:18 ` Juri Linkov
  2014-12-12  7:55   ` Dani Moncayo
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2014-12-12  0:18 UTC (permalink / raw
  To: Dani Moncayo; +Cc: 19353

> Recipe:
> 0. emacs -Q
> 1. Create and empty buffer.
> 2. Write there this text (without the hyphen lines):
> --------------
> fat cat path
> too book cool
> --------------
> 3. Place point just after the "a" in "path".
> 4. Type: C-s a t

> 5. Place point just after the first "o" in "cool".
> 6. Type: C-s o o

Does this patch address all your test cases?  It prolongs the
boundary of the wrapped search by the length of the search string,
and in the worst case it might lazy-highlight some matches twice.

diff --git a/lisp/isearch.el b/lisp/isearch.el
index c3e473a..5fb687b 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -3063,11 +3063,13 @@ (defun isearch-lazy-highlight-search ()
 	    (bound (if isearch-lazy-highlight-forward
 		       (min (or isearch-lazy-highlight-end-limit (point-max))
 			    (if isearch-lazy-highlight-wrapped
-				isearch-lazy-highlight-start
+				(+ isearch-lazy-highlight-start
+				   (1- (length isearch-lazy-highlight-last-string)))
 			      (window-end)))
 		     (max (or isearch-lazy-highlight-start-limit (point-min))
 			  (if isearch-lazy-highlight-wrapped
-			      isearch-lazy-highlight-end
+			      (- isearch-lazy-highlight-end
+				 (1- (length isearch-lazy-highlight-last-string)))
 			    (window-start))))))
 	;; Use a loop like in `isearch-search'.
 	(while retry





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#19353: 25.0.50; Lazy Highlighting
  2014-12-12  0:18 ` Juri Linkov
@ 2014-12-12  7:55   ` Dani Moncayo
  2014-12-15 23:45     ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: Dani Moncayo @ 2014-12-12  7:55 UTC (permalink / raw
  To: Juri Linkov; +Cc: 19353

> Does this patch address all your test cases?

Yes Juri, it does.

Thank you.

-- 
Dani Moncayo





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#19353: 25.0.50; Lazy Highlighting
  2014-12-12  7:55   ` Dani Moncayo
@ 2014-12-15 23:45     ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2014-12-15 23:45 UTC (permalink / raw
  To: Dani Moncayo; +Cc: 19353-done

Now the patch is committed, thank you for the suggestion.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-15 23:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-11 21:12 bug#19353: 25.0.50; Lazy Highlighting Dani Moncayo
2014-12-12  0:18 ` Juri Linkov
2014-12-12  7:55   ` Dani Moncayo
2014-12-15 23:45     ` Juri Linkov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.