[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60143: 29.0.60; command `undo-redo` don't restore cursor position
From: |
Eli Zaretskii |
Subject: |
bug#60143: 29.0.60; command `undo-redo` don't restore cursor position |
Date: |
Mon, 19 Dec 2022 05:35:49 +0200 |
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: yinz Liu <liuyinz95@gmail.com>, 60143@debbugs.gnu.org
> Date: Sun, 18 Dec 2022 20:42:31 -0500
>
> > So I very much hesitate to change this. Stefan, any comments?
>
> Changing that code is likely wrong, indeed. If the undo doesn't get
> you where you expected, it should usually be changed by adding an
> additional record to the undo log.
>
> That "record" is a simple integer indicating the position of point at
> that moment (citing `C-h o buffer-undo-list`):
>
> An entry of the form POSITION indicates that point was at the buffer
> location given by the integer. Undoing an entry of this form places
> point at POSITION.
>
> As for whether we should add such a record in the OP's scenario, and how
> to do that, I haven't looked at his scenario in enough detail to have
> much to say about it.
I don't think we record position of point before deletion. Which is
why 'undo' in that scenario also ends up with point before the
recovered deletion.