Skip to content
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

Changes combining after a series of actions #128

Open
aaxu opened this issue Dec 13, 2017 · 3 comments
Open

Changes combining after a series of actions #128

aaxu opened this issue Dec 13, 2017 · 3 comments

Comments

@aaxu
Copy link
Contributor

aaxu commented Dec 13, 2017

Wasn't really sure how to title this, but consider this situation

  • Type out some string all on one line
  • Perform a carriage return
  • Type some more stuff (which could represent many actions that would occur after the first line has been typed)
  • Undo back to before the carriage return
  • Type some more stuff (these will be on the same line as the first line)
  • Undo

This last undo right now would undo the entire first line. Should we keep it like this, or would it be better to separate the two changes, since there was a gap between them?

@dschuyler
Copy link
Collaborator

Yeah, I think it makes sense to keep the logical break, err, keep it as two undo steps.
I can see how/why the code would do that. I can think of brute force ways of coping with it (like keeping a separate flag or inserting markers in the redo chain. Is there an elegant solution?

@aaxu
Copy link
Contributor Author

aaxu commented Dec 13, 2017

I was thinking that we could just check if self.redoIndex != len(self.redoChain) and if so, we do not merge changes. However, our implementation truncates the chain when we add a new change, while we merge with previous actions in compoundChangePush at the end, so we may end up needing a new instance variable still.

@aaxu
Copy link
Contributor Author

aaxu commented Dec 22, 2017

I found a different issue that actually stems from this problem. Lets say you save after typing some string of characters, save, and exit. Open up the file again and type a few more characters. Because the last change was an insertion, the change will be coalesced together. The issue with this is that this makes the program think that the file is not dirty.

This issue should also be fixed if we make a break between time gaps (ie: if we save, set the flag to true, so the next change is not coalesced)

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

No branches or pull requests

2 participants