Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task: improve/harden the pg-protected-undo function #803

Open
erikmd opened this issue Nov 23, 2024 · 1 comment
Open

Task: improve/harden the pg-protected-undo function #803

erikmd opened this issue Nov 23, 2024 · 1 comment

Comments

@erikmd
Copy link
Member

erikmd commented Nov 23, 2024

I had refactored PG's behavior w.r.t. C-_ a long time ago (which was fairly broken before my patches)

There is a limitation of the current algorithm of "pg-protected-undo":

  1. one idea of this feature is that PG retracts by defaults, except when one edits just inside a comment
  2. this idea applies as well if we kill a region within a single comment
  3. but the implementation of this idea was done so that it just checks whether the first char and the last char are within comments
  4. as a result, the limitation is that "if we kill a region that spans over two distinct comments", then it doesn't retract (while it should, as we removed text from the comments and some *) (* chars...)

FTR: see also #800

@monnier
Copy link
Contributor

monnier commented Nov 24, 2024

My suggestion in Issue#800 was probably naive. I think the problem is more subtle because
when we undo a deletion of "foo ) bar ( baz" it means we'll add this string, but we can't figure out whether
this undo will change non-comment code without a much finer analysis (in the general case we'll need to compare the code after the undo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants