-
Notifications
You must be signed in to change notification settings - Fork 57
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
Custom undo/redo implementation (#97) #98
Conversation
alexeyinkin
commented
Oct 28, 2022
- Resolves Custom undo/redo implementation #97
Timer? _debounceTimer; | ||
|
||
@visibleForTesting | ||
final stack = <CodeHistoryRecord>[]; |
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.
actually it is not a stack. Please name it suitably, or create data structure, which will able to push and popRange. It may be named LimitStack with max records at constructor
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.
There is no problem calling a variable after our usage intention and not after a class. If we want to push and pop with a list, we can call it 'stack'.
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.
Don't you think that this approach makes ambiguily while reading the code. If we rename this field to recordList
and methods like saveRecord
, removeRecords
and so on, code will be core clear to understand.
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.
+
|
||
void beforeChanged(Code code, TextSelection selection) { | ||
_dropRedoIfNeed(); | ||
bool save = false; |
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.
Please name it using convention of naming bool variables
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.
The appropriate mode is 'should' which would turn a 4-char variable to a 10-char variable, so I would rather not.
Naming is less strict with local variables than it is with wider-scoped ones.
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.
Naming is less strict with local variables than it is with wider-scoped ones.
Considering broken windows theory it isn't. I believe, that code have to be clean, regardless it placement. Specifically at this place renaming won't create any additional line breaks, but code will be more readable
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.
+