paranext / paranext-core

Electron client, extension host, and C# library for Paranext
https://paranext.github.io/paranext-core/
MIT License
16 stars 2 forks source link

Editor reloads on edit - normalization removes spaces #1071

Open irahopkinson opened 3 weeks ago

irahopkinson commented 3 weeks ago

Describe the bug When editing the text, sometimes the cursor is moved to the start of the verse.

To Reproduce Steps to reproduce the behavior:

  1. In the Platform.Bible menu, click Open Scripture Editor and select a project.
  2. Place the cursor at the end of a sentence.
  3. Type a space, wait 1 second and then type a letter.
  4. Now hit Backspace. The space is removed and the cursor jumps to the start of the verse.

Expected behavior The space should be retained and the cursor should not move.

Likely scenario The editor reloads because the data has changed. I believe the data has changed because the PTData normalizer in C# removes the space. When the editor reloads the cursor is set to the start of the verse.

tjcouch-sil commented 3 weeks ago

I also found this a while ago when filing all those editor bugs I filed. I guess I forgot to file this one or just neglected to do so. I had this in my notes:

Normalization is making us lose the cursor. Type a new word, then delete the word (leave the space). The double space is reduced to one space, and the cursor disappears