Skip to content

Fixing resize split can cause crashes when node is root#4139

Open
Neko-Box-Coder wants to merge 1 commit into
micro-editor:masterfrom
Neko-Box-Coder:FixResizeSplit
Open

Fixing resize split can cause crashes when node is root#4139
Neko-Box-Coder wants to merge 1 commit into
micro-editor:masterfrom
Neko-Box-Coder:FixResizeSplit

Conversation

@Neko-Box-Coder

Copy link
Copy Markdown
Contributor

Fixing resize split can cause crashes when node is root.

"Regression" of #3983 where ResizeSplit() assumed that the root node always has a single child which aligns to the previous behavior.

Found this behavior when trying to resize a lone split like so:

tree_view:ResizePane(tree_width)

where tree_view is a lone pane and ResizePane() calls n.ResizeSplit(size).

Comment thread internal/views/splits.go Outdated
Comment thread internal/views/splits.go Outdated
// String returns the string form of the node and all children (used for debugging)
func (n *Node) String() string {
if n == nil {
return "root"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is this for? How is this related to the ResizeSplit fix?

A nil node is not a root node, is it? A root node it a non-nil node returned by NewRoot(), right?

@Neko-Box-Coder Neko-Box-Coder Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess it can return "nil"?

I think I was trying to print n.parent and it crashed, hence the check here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It is supposed to crash, no? Why need to print it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, true. I have removed it.

Fixing resize split can cause crashes when node is root.

"Regression" of micro-editor#3983 where ResizeSplit() assumed that the root node
always has a single child which aligns to the previous behavior
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.

3 participants