Skip to content
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

Issue with splitting #3

Open
nrootconauto opened this issue Sep 21, 2021 · 0 comments
Open

Issue with splitting #3

nrootconauto opened this issue Sep 21, 2021 · 0 comments
Assignees

Comments

@nrootconauto
Copy link

I have found a bug. It seems in mrope_split you favor pushing right side of the node first before pushing the left side. This is problematic because you do current_index += leaf_node->node.weight; which computes the relative index of the node on line rope.c:318 which acts on the first popped node(the right side). This has lead to some weird behavior as the index is relative to the left side. I have fixed this bug on one of my projects by replacing rope.c lines 248-259 with

                       if(branch_node->right != NULL) {
				error = mrope_stack_push(&node_stack,branch_node->right);
				if(error != MROPE_OK) {
					goto error_cleanup;
				}
			}
			if(branch_node->left != NULL) {
				error = mrope_stack_push(&node_stack,branch_node->left);
				if(error != MROPE_OK) {
					goto error_cleanup;
				}
			}
@ruimaciel ruimaciel self-assigned this Sep 1, 2023
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

When branches are created from issues, their pull requests are automatically linked.

2 participants