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

Let undo can restore multiple pharses at one time #233

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kuoyliu
Copy link

@kuoyliu kuoyliu commented May 19, 2017

I add some code to fix #213.
If we removed multiple pharses at one time, and we want to undo that.
We only can restore single pharse many times in the past.
Now we can restore them in one time.

If we removed multiple pharses at one time, and we want to undo that.
We only can restore single pharse many times in the past.
Now we can restore them in one time.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.915% when pulling 457f4c2 on davis8211:Fix_#213 into b32701c on chewing:master.

src/model/UserphraseModel.h Outdated Show resolved Hide resolved
userphrase_.erase(userphrase_.begin() + index);
} else {
qWarning() << "chewing_userphrase_remove() returns" << ret;
}
// FIXME: Handle chewing_userphrase_remove fails.
}

maxundocnt = remove_cnt;
Copy link
Member

Choose a reason for hiding this comment

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

Why did you rely on maxunocnt?

Copy link
Author

Choose a reason for hiding this comment

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

I want to store how many pharses can be restored at one time.
How can I do that better?

Copy link
Member

Choose a reason for hiding this comment

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

Simply use STL iterator to traverse.

Copy link
Author

@kuoyliu kuoyliu May 19, 2017

Choose a reason for hiding this comment

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

Did you mean I should add a new STL like vector and don't use a simple global variable?

Copy link
Member

Choose a reason for hiding this comment

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

How about create a dummy Userpharse as divider between each operation?

Copy link
Author

Choose a reason for hiding this comment

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

I use vector to store in new commit
Is there any question?

After modifying, it can restore multiple phrases after restore
single phrase.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.915% when pulling 98f60c2 on davis8211:Fix_#213 into b32701c on chewing:master.

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.

Undo button can't work expectly
4 participants