react-client icon indicating copy to clipboard operation
react-client copied to clipboard

Append relative to cursors instead of insert before line breaks and end-of-document

Open unode opened this issue 4 years ago • 0 comments

Which part of the project should be enhanced?

User input or interface

Is your enhancement request related to a problem? Please describe.

In both CodiMD and HedgeDoc, adding content inserts characters "to the left" of the user's cursor. If there are multiple users in the same position, all cursors are pushed to the right. This creates problems when multiple users try to add content close to new lines, such as when trying to open multiple blank lines in a bullet list. Even when using "vim" mode and the "open above" (O) instruction, the new line character will be inserted "before the cursor at the end of the line above", which will cause the other person's cursor to move to the newline.

In hackmd.io however, the new text is added after the cursor and the above situations don't happen.

Describe the solution you'd like

The hackmd behavior seems saner and less prone to clashes when editing documents collaboratively.

A solution where the content is added without affecting other's cursors seems more predictable.

Describe alternatives you've considered

This seems to be a special case of "when other cursors are in the same position". If the cursor is one character to the right of the text being inserted, the current behavior is accurate.

Additional context

Steps to reproduce:

  1. Connect two clients to the same document.
  2. Position both clients at the end of a line.
  3. Open a new line in one of the clients and type some characters.
  4. The cursor of the other client should also move along with the creation of new content.
  5. If two users start typing simultaneously, the content will be intertwined.

unode avatar Dec 17 '21 13:12 unode