emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 24.2.92 pretest: bugs in isearch-yank-line in info page. [Patch]


From: Alan Mackenzie
Subject: Re: 24.2.92 pretest: bugs in isearch-yank-line in info page. [Patch]
Date: Thu, 14 Feb 2013 20:09:38 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jan 10, 2013 at 01:25:30PM +0000, Alan Mackenzie wrote:
> Emacs 24.2.92.

> emacs -Q
> C-u C-h i
> Enter path/to/elisp.info <CR>
> g Syntax Table Internals

[ .... ]

> 2. Place point at the start of the second paragraph ("Each entry in a
> ....").  Attempt C-s M-s C-e (isearch-yeank-line).  This works, but
> wrongly highlights the gap preceding the paragraph with lazy-highlight
> face.

This wrong highlighting is a regression, introduced when a space in a
normal isearch was made to match any sequence of WS characters.

The bug's mechanism is that the current match in the buffer is
redundantly given lazy highlighting, although it is already highlighted
with isearch-face.  Sometimes the region being lazy-highlit is bigger
than the current match, and the lazy highlighting spills into the
surrounding area.  This is what is happening here.

The solution I propose is NOT to lazy-highlight when the LH region
overlaps with the current match.

Here is a patch for this change:



=== modified file 'lisp/isearch.el'
*** lisp/isearch.el     2013-02-01 23:38:41 +0000
--- lisp/isearch.el     2013-02-14 19:49:37 +0000
***************
*** 2862,2867 ****
--- 2862,2868 ----
  (defvar isearch-lazy-highlight-end-limit nil)
  (defvar isearch-lazy-highlight-start nil)
  (defvar isearch-lazy-highlight-end nil)
+ (defvar isearch-lazy-highlight-point nil)
  (defvar isearch-lazy-highlight-timer nil)
  (defvar isearch-lazy-highlight-last-string nil)
  (defvar isearch-lazy-highlight-window nil)
***************
*** 2938,2943 ****
--- 2939,2945 ----
          isearch-lazy-highlight-window-end   (window-end)
          isearch-lazy-highlight-start        (point)
          isearch-lazy-highlight-end          (point)
+         isearch-lazy-highlight-point        (point)
          isearch-lazy-highlight-wrapped      nil
          isearch-lazy-highlight-last-string  isearch-string
          isearch-lazy-highlight-case-fold-search isearch-case-fold-search
***************
*** 3014,3033 ****
                (if found
                    (let ((mb (match-beginning 0))
                          (me (match-end 0)))
!                     (if (= mb me)     ;zero-length match
!                         (if isearch-lazy-highlight-forward
!                             (if (= mb (if isearch-lazy-highlight-wrapped
!                                           isearch-lazy-highlight-start
!                                         (window-end)))
!                                 (setq found nil)
!                               (forward-char 1))
                            (if (= mb (if isearch-lazy-highlight-wrapped
!                                         isearch-lazy-highlight-end
!                                       (window-start)))
                                (setq found nil)
!                             (forward-char -1)))
! 
!                       ;; non-zero-length match
                        (let ((ov (make-overlay mb me)))
                          (push ov isearch-lazy-highlight-overlays)
                          ;; 1000 is higher than ediff's 100+,
--- 3016,3041 ----
                (if found
                    (let ((mb (match-beginning 0))
                          (me (match-end 0)))
!                     (cond
!                      ((= mb me)       ;zero-length match
!                       (if isearch-lazy-highlight-forward
                            (if (= mb (if isearch-lazy-highlight-wrapped
!                                         isearch-lazy-highlight-start
!                                       (window-end)))
                                (setq found nil)
!                             (forward-char 1))
!                         (if (= mb (if isearch-lazy-highlight-wrapped
!                                       isearch-lazy-highlight-end
!                                     (window-start)))
!                             (setq found nil)
!                           (forward-char -1))))
! 
!                      ((if isearch-lazy-highlight-forward
!                           (or (<= me isearch-other-end)
!                               (>= mb isearch-lazy-highlight-point))
!                         (or (<= me isearch-lazy-highlight-point)
!                             (>= mb isearch-other-end)))
!                       ;; non-zero-length match not overlapping found string
                        (let ((ov (make-overlay mb me)))
                          (push ov isearch-lazy-highlight-overlays)
                          ;; 1000 is higher than ediff's 100+,
***************
*** 3035,3040 ****
--- 3043,3052 ----
                          (overlay-put ov 'priority 1000)
                          (overlay-put ov 'face lazy-highlight-face)
                          (overlay-put ov 'window (selected-window))))
+                      
+                      ; (t nil)   ; the match overlaps current found string.
+                      )
+ 
                      (if isearch-lazy-highlight-forward
                          (setq isearch-lazy-highlight-end (point))
                        (setq isearch-lazy-highlight-start (point)))))



> -- 
> Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]