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

cursor_wordleft in qe is wrong #72

Open
janko-jj opened this issue Oct 13, 2024 · 0 comments
Open

cursor_wordleft in qe is wrong #72

janko-jj opened this issue Oct 13, 2024 · 0 comments

Comments

@janko-jj
Copy link

janko-jj commented Oct 13, 2024

This line in cursor_wordleft

uint16_t right = *--gap_start = *--gap_end;

corrupts the edited file. Reason: the invariant of gap_start and gap_end is that the start points to the empty space and gap_end to the first valid character after the gap.

Here, the gap_end is first moved to the "empty space" then that byte is copied over the previously valid character. Each time the function is executed in the line with more words, starting from the last word, more unpredictable bytes are inserted.

(And because it's always a byte, uint8_t should be enough too, but that doesn't change the described 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

No branches or pull requests

1 participant