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

Must undo twice to undo paredit delete-empty-list if reformat-as-you-type altered the document #2702

Open
pbwolf opened this issue Jan 11, 2025 · 2 comments

Comments

@pbwolf
Copy link
Contributor

pbwolf commented Jan 11, 2025

If reformat-as-you-type is engaged, and you use paredit backspace or deleteForward to remove an empty list (which triggers reformat-as-you-type, if it's engaged), and the reformatter changes the document text (which it doesn't always), then you need to use Undo twice to get the empty list back.

For example, start with a flush-left outer form that contains an overly-indented line with an empty list; cursor positioned inside the empty list:

(do
    42 (|))

Backspace; now you have

(do
  42 |)

Undo once:

(do
    42 )

Undo again:

(do
    42 (|))

On the other hand, if reformat-as-you-type only moves the cursor, without changing the document text, then one Undo is enough: start with

(do
  42 (|),,,)

Backspace

(do
  42 ,,,|)

Undo just once, and it restores the empty list.

@pbwolf
Copy link
Contributor Author

pbwolf commented Jan 11, 2025

This might be a conflict between the resolution of #2611 and Calva's format-as-you-type. The same problem can be induced for another paredit command (slurp forward) by removing the undoStopAfter:false override from DocumentModel.edit. Backspace and deleteForward, which as of #2611 are registered with registerTextEditorCommand, do not control the undoStop settings of the TextEditorEdit that they receive from VS Code.

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
@pbwolf and others