Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

[Bug]: Invalid cursor placement after "Format code" action #1206

Closed
2 tasks done
gituser1000000 opened this issue Aug 12, 2023 · 4 comments
Closed
2 tasks done

[Bug]: Invalid cursor placement after "Format code" action #1206

gituser1000000 opened this issue Aug 12, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@gituser1000000
Copy link

gituser1000000 commented Aug 12, 2023

What happened?

Undoing a "Format code" (applying to a selection or the whole file) action places the cursor all the way at the end of the file.

What's the expected behavior?

The cursor should be right where it was before the code format.

What version of AndroidIDE you're using?

v2.5.2 (debug builds)

Relevant log output

No response

Duplicate issues

  • This issue has not been reported yet.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@gituser1000000 gituser1000000 added the bug Something isn't working label Aug 12, 2023
@gituser1000000 gituser1000000 changed the title [Bug]: Undoing a "Formatcode" action [Bug]: Undoing a "Format code" action Aug 12, 2023
@itsaky
Copy link
Member

itsaky commented Aug 12, 2023

I'll work on this later. Currently busy with something else.

@itsaky
Copy link
Member

itsaky commented Aug 23, 2023

The IDE only formats the given input (selection or whole file), the editor handles the content changes after the formatting action. I think it would be better if this issue is reported in the editor's repository.

@itsaky itsaky changed the title [Bug]: Undoing a "Format code" action [Bug]: Invalid cursor placement after "Format code" action Aug 23, 2023
@Rosemoe
Copy link
Member

Rosemoe commented Aug 24, 2023

It's actually because the editor does not record where the cursor is when text is changed. The cursor just shifts as primitive text actions(insert or delete) are performed.
I'll improve undo/redo experience in this case soon.

@itsaky
Copy link
Member

itsaky commented Aug 28, 2023

Fixed in Rosemoe/sora-editor@8273b91

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants