-
Notifications
You must be signed in to change notification settings - Fork 52
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
base: master
Are you sure you want to change the base?
Conversation
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.
src/model/UserphraseModel.cpp
Outdated
userphrase_.erase(userphrase_.begin() + index); | ||
} else { | ||
qWarning() << "chewing_userphrase_remove() returns" << ret; | ||
} | ||
// FIXME: Handle chewing_userphrase_remove fails. | ||
} | ||
|
||
maxundocnt = remove_cnt; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.