Editor refactoring mode#11
Conversation
…between non-empty pretty blocks if there is more than one block
d48170e to
0534da2
Compare
…esized blocks are ephemeral
All context variables need hard resets before each test (sharing controller object without cleanup -> cursor chaos)
aldum
left a comment
There was a problem hiding this comment.
Since the number of conttributors is spiking, I'm rethinking the branching strategy. We will be working against dev, please rebase the PR against it.
Another thing I'd like see codebase-wide (meaning I need to clean up some of my older work too) is type annotations for all public classes and functions. In the case of this PR, EditorSession is a prominent example, it would aid in communicating intent to the reader immensely.
Other than that, good quality code, I really appreciate the usage of my table utilities :)
| end | ||
|
|
||
| --- @return integer | ||
| function BufferView:get_size() |
There was a problem hiding this comment.
This is not quite correct conceptually, I probably should have named the field better.
The 'size' of a buffer(view) is number of lines it currently holds, which can be less than the maximum, so this should probably be called get_max_size. It might also be redundant, because the value comes from the config, which should be available wherever this value is read (haven't check all call sites yet), however, there might be use for smaller sub-buffers, splits, etc in the future, we can keep the function.
| return table.find_by(chunks, is_oversized_chunk) | ||
| end | ||
| end | ||
| local to_lines = function(x) return x.lines end |
There was a problem hiding this comment.
We could also add this as a helper in Chunk, returning an empty table or nil for Empty
This change solves compy-toys#115 introducing "refactoring mode"
Some work is still pending -- going to add tests, and probably check the code against style conventions.
But the supposed logic can be reviewed already.