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

support undo/redo with truncate #23

Merged
merged 2 commits into from
Jan 19, 2017

Conversation

iamcodemaker
Copy link
Contributor

Prior to this patch, typing some text, moving to the start of the line,
then deleting until the end of the line and attempting to undo will
cause a panic. This is because the truncate() operation did not update
the undo list. This has been corrected.

@iamcodemaker
Copy link
Contributor Author

iamcodemaker commented Jan 2, 2017

The tests fail because termion is reporting the terminal witdh to be 0. Liner does not like this. Not sure how to fix this, the same thing happens if I run in lldb on my mac. Note: tests pass when I run cargo test from the terminal.

@iamcodemaker
Copy link
Contributor Author

This has some bugs in it. It only works if you delete the entire line. Working on a fix for partial deletes.

@iamcodemaker
Copy link
Contributor Author

Fixed.

@iamcodemaker
Copy link
Contributor Author

Just pushed a new rev that fixes the tests.

@MovingtoMars
Copy link
Owner

I'm not sure if there needs to be a separate Action::Truncate rather than just using Action::Delete. Is the an advantage to adding a new action variant?

@iamcodemaker
Copy link
Contributor Author

Could do this with Delete as well. I'll rework the patch. Standby.

When testing on travis, the terminal width is returned as 0 which leads
to a divide-by-zero error. Hardcoding the size when testing avoids this
issue.
@iamcodemaker
Copy link
Contributor Author

Ok, I reworked the patch to use the Delete action and added some more unit tests.

Prior to this patch, typing some text, moving to the start of the line,
then deleting until the end of the line and attempting to undo will
cause a panic. This is because the truncate() operation did not update
the undo list. This has been corrected.
@MovingtoMars MovingtoMars merged commit 2de5653 into MovingtoMars:master Jan 19, 2017
@iamcodemaker iamcodemaker deleted the truncateundo branch June 15, 2017 03:40
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.

2 participants