mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Provide an accurate panic message when translating points off the end of a line
Maybe we should fail more gracefully in this case, but I think we should at least make the message accurate and see how we do.
This commit is contained in:
parent
137fbd0088
commit
7c9e4e513c
@ -565,6 +565,12 @@ impl Chunk {
|
||||
|
||||
if ch == '\n' {
|
||||
point.row += 1;
|
||||
if point.row > target.row {
|
||||
panic!(
|
||||
"point {:?} is beyond the end of a line with length {}",
|
||||
target, point.column
|
||||
);
|
||||
}
|
||||
point.column = 0;
|
||||
} else {
|
||||
point.column += ch.len_utf8() as u32;
|
||||
|
Loading…
Reference in New Issue
Block a user