scribe
scribe copied to clipboard
Fix a bug in the read function
In line 124 of gap_buffer.rs, we find:
String::from_utf8_lossy(&self.data[start_offset..end_offset]).into_owned()
The end_offset
is actually an index of a character at the end of the range. This character index should be included in the slice. The same applies to one earlier line: line 113.
This proposal modifies the two broken lines of code to use ..=end_offset
instead. Another solution would be ..end_offset+1
.
This proposal might change some behavior in code that relied upon the faulty read
function. My contribution is licensed MIT.
Thanks!