From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 21523@debbugs.gnu.org, Barry O'Reilly <gundaetiapo@gmail.com>,
drew.adams@oracle.com
Subject: bug#21523: 25.0.50; Undo with active region adds extra text
Date: Thu, 05 May 2022 16:37:45 +0200 [thread overview]
Message-ID: <87y1zgniyu.fsf@gnus.org> (raw)
In-Reply-To: <878s0ydglj.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 18 Aug 2021 15:31:36 +0200")
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Actually, the problem seems to be in undo-adjust-elt, which was
> rewritten in 2014 to fix bug#17235.
>
> I've now added a test case (commented out), but I don't quite understand
> the logic in undo-adjust-elt... anybody see something obviously wrong?
(defun undo-adjust-elt (elt deltas)
[...]
;; (TEXT . POSITION)
(`(,(and text (pred stringp)) . ,(and pos (pred integerp)))
(cons text (* (if (< pos 0) -1 1)
(undo-adjust-pos (abs pos) deltas))))
The problem seems to be here. In my test case, this make the ("This"
. 1) entry into a ("This" . 5) entry, which is then included in the
region. Using < instead if <= works for this particular test case, but
not for undo-test-region-eob.
I've added Barry to the CCs; perhaps he has some insights here.
For reference, this is the test case:
(ert-deftest test-undo-region ()
(with-temp-buffer
(insert "This is a test\n")
(goto-char (point-min))
(setq buffer-undo-list nil)
(downcase-word 1)
(should (= (length (delq nil (undo-make-selective-list 1 9))) 2))
;; FIXME: These should give 0, but currently give 1.
;;(should (= (length (delq nil (undo-make-selective-list 4 9))) 0))
;;(should (= (length (delq nil (undo-make-selective-list 5 9))) 0))
(should (= (length (delq nil (undo-make-selective-list 6 9))) 0))))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
prev parent reply other threads:[~2022-05-05 14:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-20 7:34 bug#21523: 25.0.50; Undo with active region adds extra text Drew Adams
2015-09-20 15:14 ` Stefan Monnier
2015-09-20 18:26 ` Richard Stallman
2015-09-20 19:43 ` Stefan Monnier
2021-08-16 12:39 ` Lars Ingebrigtsen
2021-08-16 13:13 ` Eli Zaretskii
2021-08-16 13:53 ` Lars Ingebrigtsen
2021-08-16 16:30 ` Eli Zaretskii
2021-08-18 13:31 ` Lars Ingebrigtsen
2022-05-05 14:37 ` Lars Ingebrigtsen [this message]
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=87y1zgniyu.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=21523@debbugs.gnu.org \
--cc=drew.adams@oracle.com \
--cc=eliz@gnu.org \
--cc=gundaetiapo@gmail.com \
/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).