Skip to content

Editor refactoring mode#11

Open
hleb-rubanau wants to merge 22 commits intoaldum:masterfrom
hleb-rubanau:features/editor_refactoring_mode
Open

Editor refactoring mode#11
hleb-rubanau wants to merge 22 commits intoaldum:masterfrom
hleb-rubanau:features/editor_refactoring_mode

Conversation

@hleb-rubanau
Copy link
Copy Markdown

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.

@hleb-rubanau hleb-rubanau marked this pull request as draft March 23, 2026 19:59
@hleb-rubanau hleb-rubanau force-pushed the features/editor_refactoring_mode branch from d48170e to 0534da2 Compare March 23, 2026 20:27
@hleb-rubanau hleb-rubanau marked this pull request as ready for review March 23, 2026 21:19
Copy link
Copy Markdown
Owner

@aldum aldum left a comment

Choose a reason for hiding this comment

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

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 :)

Comment thread src/controller/editorController.lua
end

--- @return integer
function BufferView:get_size()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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.

Comment thread src/controller/editorController.lua
return table.find_by(chunks, is_oversized_chunk)
end
end
local to_lines = function(x) return x.lines end
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We could also add this as a helper in Chunk, returning an empty table or nil for Empty

Comment thread src/model/editor/bufferModel.lua
Comment thread tests/helpers/editor_session.lua
Comment thread tests/helpers/editor_session.lua
Comment thread tests/editor/editor_spec.lua
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.

2 participants