In #70 I introduced a small oversight in the edge case of an empty Rope.
I initialized the Lines iterator with total_lines = 0.
However, the Lines iterator always yields atleast a single line (even if that line is empty)
which caused the subsequent underflow.
This PR fixes that by setting total_lines = 1 in the appropriate edge case.
I also added a test case to make sure this doesn't regress in the future.
Fixes #76.
In #70 I introduced a small oversight in the edge case of an empty
Rope
. I initialized theLines
iterator withtotal_lines = 0
. However, theLines
iterator always yields atleast a single line (even if that line is empty) which caused the subsequent underflow. This PR fixes that by settingtotal_lines = 1
in the appropriate edge case. I also added a test case to make sure this doesn't regress in the future.