Cursor position issue on the end of the line

Hi, I have implemented a editor with the minimal config. When I type at the end of the line the position is changed to 1 position before the end. Example:

  • I have the string “abc” in the line
  • I set the cursor at the end of the line
  • I type “de”
  • Expected : abcde
  • Real: abced.
    I notice the error occurs only when the cursor is in the last position of a line.

initial string
{D1FB8EC4-D424-4AF4-BD45-66215F76F304}
type c (new position issue)
{AF2089AD-E615-44F4-9053-D661B37037E5}
type e
{3392E055-98EF-4E94-BED0-447766F2183C}

I am usign angular 14, but i could not find the reason for that? Have you seen this issue before?

Regards

Can you reproduce this issue in a script that I can run? Preferably on codemirror.net/try.

I have reproduced it in thecodemirror.net/try selecting the option “Minimal editor”

initial position
{8A3B5476-5B77-40D5-BC5F-0AEC3932C0A6}
I type a char (A) and the cursor changes its position


I type B

I am running it in Chrome (Version 131.0.6778.109 (Official Build) (64-bit))

I have noticed that the error is not replicable in firefox (133.0 64 bits)

Thanks, I can reproduce on Chrome. That was a recent regression. Attached patch should help.

1 Like

Sorry, I am new with codemirror, how can i apply the Patch?, should I download the package from the Angular npm?

Thank you, It is a great library.

@codemirror/view 6.35.2 has this fix. It is on npm. (There’s no such thing as “Angular npm”, just npm.)

Got it.

Thanks