diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-26 12:15:22 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-26 12:15:22 -0500 |
commit | c5a3c1bfdd8fe0fe81a8094ab68b7a95bdb4ea39 (patch) | |
tree | dcf5aa3bf5478b73913fbd4554b36427fdba8317 /buffer.c | |
parent | 993286be407ebffb50e15cb53e28c11cfbf47dcb (diff) |
fixed buffer_pos_diff problem; undo seems to be fully working now?
Diffstat (limited to 'buffer.c')
-rw-r--r-- | buffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -243,7 +243,7 @@ static i64 buffer_pos_diff(TextBuffer *buffer, BufferPos p1, BufferPos p2) { i64 chars_in_lines_in_between = 0; // now we need to add up the lengths of the lines between p1 and p2 for (Line *line = buffer->lines + (p1.line + 1), *end = buffer->lines + p2.line; line != end; ++line) { - chars_in_lines_in_between += line->len; + chars_in_lines_in_between += line->len + 1; // +1 for newline } i64 total = chars_at_end_of_p1_line + chars_in_lines_in_between + chars_at_start_of_p2_line; return total * factor; |