[GUI] InputText.prototype._onPasteText ignores highlight part of text

Using your own example from Babylon.js docs [PG] Simple example of adding a fullscreen BabylonGUI to your scene.:

Fill input text with 123456, select\highlight 23 and ctrl+c.
Select/highlight 56 (so its highlighted) and ctrl+v.
You will get 12342356 or 12345623 depending where was carrot after you finished highlighting.
This is not what regular user expects, should be 123423
[GUI] InputText.prototype._onPasteText doesn’t remove whatever is highlighted first before adding new text.

I failed to find a reliable workaround without using internal fields for that oversight especially in situations where i have to use OnTextChangeObservable.

Thanks for reporting!

@amoebachant Is out right now, so have a little patience until he is back to check this.

No problem. In company where i work we are upgrading babylon maybe once half a year and we just upgraded not long ago, so yeah, no worries, if somebody fix it i will have that fix sometime next year.

I can verify the bug. I’ll try a solution and will keep you updated here

A fix - fix(gui): InputText paste replaces highlighted selection by RaananW · Pull Request #18694 · BabylonJS/Babylon.js · GitHub
And the PR working (snapshot only currently) - Babylon.js Playground

Thank you!