kilo
kilo copied to clipboard
fix a typo when deleting a row
I believe struct erow
requires the following invariant:
for (int i = 0; i < E.numrows; ++i)
assert(E.row[i].idx == i);
This is important because erow.idx
is used to index into E.row
in various places. Incrementing idx
can cause out of bounds access and memory corruption.
Interestingly, the snaptoken tutorial for kilo includes this fix (in step 183). That gives me some confidence that I'm on the right track.
I noticed it as well, and took me a while to convince myself until I saw the tutorial, and your PR here:).