F0rce/ace

Replace a text put the first character of the new text at the last position

jcgueriaud1 opened this issue · 6 comments

Describe the bug
When I select a text in the ace editor and type a new text the first character is at the last position.

To Reproduce
Steps to reproduce the behavior:

  • In the aceeditor, type "CONTENT"
  • Select the text "CONTENT", type "123456"
  • The result is "234561"

Expected behavior
The result should be: "123456"

Screenshots
https://user-images.githubusercontent.com/51313578/116244662-ce0bfd00-a770-11eb-9965-56dc1f1b7a0f.mov

I've got this issue in Vaadin 14.5.3 + v1.1.0.

But also when I pull the master branch and run mvn jetty:run

F0rce commented

Hello @jcgueriaud1,

I have some problems recreating your issue. When I start my ace editor and use your given steps, the result is "123456".

Could you maybe tell me the settings you use for the ace editor itself ? (java methods, size, etc.)

Thanks in advance,
David

I'm able to reproduce it in the demo, I didn't change the code: https://github.com/F0rce/ace/blob/master/src/test/java/de/f0rce/View.java
I pulled the master branch and run mvn jetty:run.

When I replace a text and type a character the cursor is placed before the character.
If I select the text and type backspace then the text it's working.

I'm using Mac, Java11. I don't know if it matters.
I also tried the demo here: https://ace.c9.io/ and this demo is working

F0rce commented

super, super wierd.

I'll absolutely have to give it a major investigation. Because I really cant reproduce it. Im on Windows with Java 8 but i'm gonna setup the ace editor on my mac with the same java version as you.

I'll give it high priority

F0rce commented

Update:

I reverted some of my changes to the frontend in my local test szenario and was able to reproduce the issue, i'm working on a fix :)

Thanks a lot for your fast answer.

F0rce commented

I have discovered, what this issue caused. It has to do with Ace Editor's selectionChange event, which triggers more often than usual. This also seems to be the issue of for the other issue (can't tag on mobile). I'll try to write a debounce version of the selectionChange Event.

Have a great day and sorry for the lack of support,
David