From: Lars Hansen <larsh@math.ku.dk>
Cc: emacs-devel@gnu.org
Subject: Re: [BUG] widget-field-overlay becomes wrong
Date: Sun, 04 Jul 2004 11:47:37 +0200 [thread overview]
Message-ID: <40E7D239.3040403@math.ku.dk> (raw)
In-Reply-To: <E1Bgp8E-0003cj-0Q@fencepost.gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1150 bytes --]
Richard Stallman wrote:
>What will happen if the user deletes all the text in the editable field,
>then inserts new text? Will that newly inserted text be treated
>as part of a neighboring widget? It seems likely.
>
>
You are right, zero-sized overlays cannot be ignored as I did. Such
overlays should only go in overlays-after. This is done in the patch
attached.
>I don't think it is worth spending a lot of time to fix this,
>because I think it is fundamentally impossible, and there are
>more important things to do.
>
I don't see why it should be fundamentally impossible to fix this bug.
AFAICS a widget cannot have zero size, and if it has a zero-sized
overlay at one end, it is at the start.
I want to fix this bug because it annoys me in some tests I am doing.
I suggest we install my patch. It can always be removed if it has
undesirable consequences.
>For instance, would you be interested
>in working on making saving of text properties in files more
>convenient? That is more important.
>
I would be happy to work much more on Emacs. However, that requires
someone to finance it :-). Right now I don't have the time :-(.
[-- Attachment #2: wid-edit.el.diff --]
[-- Type: text/plain, Size: 2444 bytes --]
*** wid-edit.el.~1.128.~ Tue Jun 8 21:50:16 2004
--- wid-edit.el Sun Jul 4 10:34:13 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,444 ----
(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 (and (= (point) (overlay-end overlay))
! (not (= (point) (overlay-start 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)
--- 1548,1553 ----
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2004-07-04 9:47 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-30 9:46 [BUG] widget-field-overlay becomes wrong Lars Hansen
2004-07-01 17:14 ` Richard Stallman
2004-07-01 20:08 ` Lars Hansen
2004-07-02 6:02 ` Lars Hansen
2004-07-03 18:20 ` Richard Stallman
2004-07-04 9:47 ` Lars Hansen [this message]
2004-07-07 16:02 ` Per Abrahamsen
2004-07-08 12:30 ` Lars Hansen
2004-07-08 23:18 ` Richard Stallman
2004-07-09 21:10 ` Lars Hansen
2004-07-13 15:00 ` Per Abrahamsen
2004-07-14 7:00 ` Lars Hansen
2004-07-19 7:31 ` Per Abrahamsen
2004-07-19 18:44 ` Richard Stallman
2004-07-23 16:24 ` Per Abrahamsen
2004-07-24 16:28 ` Lars Hansen
2004-08-01 15:18 ` Per Abrahamsen
2004-08-02 9:08 ` Lars Hansen
2004-08-02 12:21 ` Per Abrahamsen
2004-07-24 19:43 ` Richard Stallman
2004-08-01 15:33 ` Per Abrahamsen
2004-08-02 9:07 ` Lars Hansen
2004-08-03 19:37 ` Richard Stallman
2004-08-03 21:18 ` Lars Hansen
2004-08-03 21:25 ` Lars Hansen
2004-08-05 4:22 ` Richard Stallman
2004-08-05 6:22 ` Lars Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40E7D239.3040403@math.ku.dk \
--to=larsh@math.ku.dk \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).