Skip to content

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

Open
@pbwolf

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions