ajaxorg / ace

Ace (Ajax.org Cloud9 Editor)
https://ace.c9.io
Other
26.73k stars 5.28k forks source link

deletion undo leaves the text selected #5219

Open alexbodn opened 1 year ago

alexbodn commented 1 year ago

Describe the bug

hello friends,

and i thank you for the great editor. i have to report something that i think should work better.

if i delete some text and undo the action, the text is being pasted, chunk by chunk, to the place it was at. the problem is, that the last pasted chunk remains "selected", so that the next character we type would overwrite that chunk.

thanks for your attention, alex

Expected Behavior

i would suggest, that undo will clear the selection of the undone chunk. if the user wants to, he may redo the deletion.

Current Behavior

the last chunk pasted by undo remains selected, so it gets overwritten by the next typed characters.

Reproduction Steps

type => result text

abc => abc backspace => ab ^z => abc d => abd

Possible Solution

clear text selection after undo.

Additional Information/Context

No response

Ace Version / Browser / OS / Keyboard layout

the demo site ace.js, in google chrome, chromeos

nightwing commented 1 year ago

This is an intentional behavior so that user can see what was changed by undo.

As an alternative we can restore the selection to the place it was before undo. That is after inserted text, if it was removed by backspace, before if it was removed by delete, and select, if user have selected a range and typed or pressed delete, over the selection. And it would make multiple selections if delete was done by multiple selections.

Would this behavior work for you, or do you expect the cursor to always be after the inserted text?

github-actions[bot] commented 1 year ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

github-actions[bot] commented 1 day ago

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.