-
Notifications
You must be signed in to change notification settings - Fork 35
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
Reduce use of File's internal details #195
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Text maintains a cache of text insertions that should be Undo-able as a group. Relocate this cache into File so that the File API surface makes a small step closer to the undo.Buffer which encapsulates undo with well-defined Commit points. A step towards #97.
Post relocating of the typing cache, cleanup some additional code.
There is a frequent pattern in the code to reach into File's buffer implementation to determine the number of runes contained in the File. This impedes replacing File's internal details so switch external users to the Size function on File objects. Helps with #97.
Modify File.Commit to have API alignment with undo.Buffer's Commit. Helps with #97.
Advance the semantic fit between undo.Buffer and File by renaming the existing Insert and Delete methods to InsertAt and DeleteAt. Helps #97.
Move the FileHash code into a separate file to simplify the File code. Cleanup to help with #97.
Refactor the code in Text.Insert to let File.InsertAt (uniformly) invoke an observer pattern on any insertion. Helps with #97. NB: not complete. Rebase in follow-on cleanup CLs. In particular, Undo doesn't redraw the box correctly in this change.
Refactor the code in DeleteAt to run observers. Helps #97. Fixes the problem with deletion in Zerox Windows noted in the previous CL.
Helps with #97. Moving towards to keeping the observer pattern an opaque detail.
Reduce the number of places that look into internal details of File by adding a HasMultipleTexts accessor. Simplifies code for helping #97.
Altering File for #97 permits removing the use of curtext from allupdate.
Rewrite File.Load in terms of File.InsertAt to adapt it to the undo.Buffer API surface. This also simplifies the code by Re-using the new observer structure. Helps with #97.
File.Close does not map to undo.Buffer so clean up this and some other unnecessary code. Helps with #97.
Remove an unnecessary use of File's internal details. Helps #97.
Remove some unnecessary code and add a comment.
Window shouldn't reach into File internal details. Start reducing this. Code cleanup tangential to #97.
Further reduce the cases where Window reaches into File's deails.
oops |
Codecov Report
@@ Coverage Diff @@
## master #195 +/- ##
==========================================
+ Coverage 19.37% 19.63% +0.26%
==========================================
Files 45 45
Lines 10261 10209 -52
==========================================
+ Hits 1988 2005 +17
+ Misses 8091 8018 -73
- Partials 182 186 +4
Continue to review full report at Codecov.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A bunch of cleanups aimed to isolate the internals of File.