Skip to content

Don't run setDirty while IME input is unconfirmed. #164366

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

guttyon
Copy link
Contributor

@guttyon guttyon commented Oct 23, 2022

@alexr00 alexr00 assigned alexdima and unassigned alexr00 Oct 24, 2022
@guttyon
Copy link
Contributor Author

guttyon commented Oct 31, 2022

Fixes #164351 (comment)
The following process has been added to solve this issue.

This commit can be applied independently of the first commit.

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huge change that brings the knowledge of IME (via the unconfirmed flag) to the world. I am not convinced of doing something very special for IME here. Also the file is dirty when not using IME and pressing for example A and then pressing Backspace. In other words, the dirty flag is not text buffer content based.

The proposed change is huge and I think a much more elegant solution would be to do something around equality. Perhaps we can compute the text model's sha1 in the web worker or something like that.

@guttyon
Copy link
Contributor Author

guttyon commented Oct 31, 2022

Thank you for your review.

There were too many changes to propagate the unconfirmed flag. I will PR again when I come up with a solution with fewer changes.

What about my second comment: #164366 (comment)

I think this commit has relatively few changes.

@alexdima
Copy link
Member

What about my second comment: #164366 (comment)

I think the right way to go here is to change the isDirty implementation in the workbench to be content based. Perhaps the TextFileEditorModel could remember the sha1 of the contents of the file on disk. Then, it can optimistically set isDirty using the current rules it already has, but it could kick off a sha1 computation on a web worker. If the computed sha1 is equal to the file on disk sha1, ti could mark the file as not dirty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The change flag lights up when the IME input is not yet finalized.
4 participants