mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
api: return error when starting a slice out of bounds.
This commit is contained in:
parent
90b4276d67
commit
7475c1c0f7
@ -179,6 +179,11 @@ void buffer_set_line_slice(Buffer buffer,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!inbounds(buf, start)) {
|
||||||
|
api_set_error(err, Validation, _("Index out of bounds"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
start = normalize_index(buf, start) + (include_start ? 0 : 1);
|
start = normalize_index(buf, start) + (include_start ? 0 : 1);
|
||||||
include_end = include_end || (end >= buf->b_ml.ml_line_count);
|
include_end = include_end || (end >= buf->b_ml.ml_line_count);
|
||||||
end = normalize_index(buf, end) + (include_end ? 1 : 0);
|
end = normalize_index(buf, end) + (include_end ? 1 : 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user