emacs-devel
[Top][All Lists]
Advanced

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

Re: [BUG] widget-field-overlay becomes wrong


From: Lars Hansen
Subject: Re: [BUG] widget-field-overlay becomes wrong
Date: Fri, 02 Jul 2004 08:02:51 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021213 Debian/1.2.1-2.bunk

Lars Hansen wrote:

I would rather like to see if I can come up with a fix.

The attached patch seems to fix the bug.

*** wid-edit.el.~1.128.~        Tue Jun  8 21:50:16 2004
--- wid-edit.el Fri Jul  2 07:49:46 2004
***************
*** 414,426 ****
      (widget-put widget :doc-overlay overlay)))
  
  (defmacro widget-specify-insert (&rest form)
!   "Execute FORM without inheriting any text properties."
    `(save-restriction
      (let ((inhibit-read-only t)
!         (inhibit-modification-hooks t))
        (narrow-to-region (point) (point))
        (prog1 (progn ,@form)
!       (goto-char (point-max))))))
  
  (defface widget-inactive-face '((((class grayscale color)
                                  (background dark))
--- 414,443 ----
      (widget-put widget :doc-overlay overlay)))
  
  (defmacro widget-specify-insert (&rest form)
!   "Execute FORM without inheriting any text properties.
! Furthermore, ensure overlays ending at point or starting at point
! does not include text inserted."
    `(save-restriction
      (let ((inhibit-read-only t)
!         (inhibit-modification-hooks t)
!           overlays-before
!           overlays-after)
!       (mapc (lambda (overlay)
!               (when (= (point) (overlay-end overlay))
!                 (setq overlays-before (cons overlay overlays-before)))
!               (when (= (point) (overlay-start overlay))
!                 (setq overlays-after (cons overlay overlays-after))))
!             (overlays-in (if (= (point) (point-min)) (point) (1- (point)))
!                          (if (= (point) (point-max)) (point) (1+ (point)))))
        (narrow-to-region (point) (point))
        (prog1 (progn ,@form)
!         (mapc (lambda (overlay)
!                 (move-overlay overlay (overlay-start overlay) (point-min)))
!               overlays-before)
!         (mapc (lambda (overlay)
!                 (move-overlay overlay (point-max) (overlay-end overlay)))
!               overlays-after)
!         (goto-char (point-max))))))
  
  (defface widget-inactive-face '((((class grayscale color)
                                  (background dark))
***************
*** 1530,1538 ****
                     (if (>= old-pos (1- to))
                         (- old-pos to 1)
                       (- old-pos from)))))
-     ;;??? Bug: this ought to insert the new value before deleting the old one,
-     ;; so that markers on either side of the value automatically
-     ;; stay on the same side.  -- rms.
      (save-excursion
        (goto-char (widget-get widget :from))
        (widget-apply widget :delete)
--- 1547,1552 ----

reply via email to

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