Directional Deletion

Value

It is often useful to delete the "thing" directly before or after the caret, for example to correct a recent typo.

Proposed Solution

In essence, deleting in either direction should remove the next "thing" in that direction.

This is usually a character or a linebreak. Deleting a linebreak should usually merge the two lines but not delete any extra character e.g.:

line1
|line2

when deleting backwards, should become:

line1|line2

When merging, the right side will be incorporated into the left side. This means that the text on the right side will now be on the same hierarchical level as the left. This can result in styling changes:

This does not happen for basic styles:

Knowledge nodes

Deletion around knowledge nodes is tricky, since the merging behavior can cause unwanted changes to the knowledge represented in the document.

An example to illustrate the problem:

John |Smith

Imagine "John" is a knowledge note with the firstname annotation, and "Smith"
has the lastname annotation.
Deleting backwards visually results in:

John|Smith

But now we face a problem! Did the user intend to change the firstname 
"John" into the (arguably bizarre, but not so strange if you consider 
usernames) name "JohnSmith"? Or is it simply a part of the process of editing,
and the user will later add back a space or some other separator, wanting to 
keep the names separate?

We err on the side of caution here until we develop a more robust editing toolkit with which the user can unambiguously tell us what they want to achieve.

This has some possibly surprising effects:

In the above situation, the date directly after the cursor is a knowledge node. If we would merge here, the date would become part of the title, which is also a knowledge node in and of itself. This would be incorrect, so instead we do not merge, and rather jump the cursor only:

Lists

Deleting at the start and end of list items is treated identical to deleting linebreaks.

Tables

Deleting backwards when at the start of a cell, or forwards when at the end, does nothing.

Only entire rows and columns can be deleted with specialized actions described in Row/column manipulation

Current Status

The implementation is documented in this RFC.

As proposed, with the following exceptions:

Knowledge Nodes

There are some inconsistencies when deleting around knowledge nodes:

In the gif, we see first deletion with the caret standing in front of the node, which leads to behavior which is not desired. However, when we reach that same position by backspacing from a bit further, the behavior is correct.

Last updated