ide-stories/vscode-stories

Non-sequential editing of code renders wrong code in story

AbhayVAshokan opened this issue · 4 comments

Expected Behavior

Mimic what I am typing even if I enter the code sequentially or write different parts of the code.

Current Behavior

The following are not recognized

  1. Using the arrow keys to navigate to a previous position and continue to type from there.
  2. Using the mouse to place the cursor to a different position and continue type to type from there.

In both these situations, the recording still preserves that I am typing sequentially and ends up replacing the characters entered in the later parts of the code.

Steps to Reproduce

Refer to the screenshots below.
The solve() function as well as the lines 35-37 were inserted after the rest of the program was completed.

Screenshots

Original code

Code from story

Context (Environment)

Detailed Description

The keystrokes on the keyboard may not be configured for arrow keys or maybe erroneous for different environments. Moving the cursor directly using the mouse is not recognized either. The above two issues lead to the stories typed in non-sequential order leading to render differently.

In addition to this, paste operation creates similar results.

Bukii commented

Hey, when you relocate the cursor to another position and the proceed typing, this new text will be placed on the very bottom of the code, like if you have never changed the cursor position, am I understanding this correctly?

Yes, that is exactly what the issue meant. I started out by placing the cursor in the middle of some code. The first few characters are rendered as required. Changing cursor position by arrow keys or mouse are not recognized and are directly added to the same line.
Also, it replaced characters in the succeeding lines when it touched them.

Bukii commented

Ok, thanks for opening this issue. Actually, there's already an issue explaining the same problem (#90), where code snippets get overwritten, but since this one is better documented, I will keep this open.