mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 05:48:17 +00:00
api: make buffer_{get,set}_slice automatically assume include_end
This is for compatibility with python-vim interface: When passing an end index with a value higher than the last index, assume the `include_end` flag
This commit is contained in:
@@ -109,6 +109,7 @@ StringArray buffer_get_slice(Buffer buffer,
|
||||
}
|
||||
|
||||
start = normalize_index(buf, start) + (include_start ? 0 : 1);
|
||||
include_end = include_end || (end >= buf->b_ml.ml_line_count);
|
||||
end = normalize_index(buf, end) + (include_end ? 1 : 0);
|
||||
|
||||
if (start >= end) {
|
||||
@@ -169,6 +170,7 @@ void buffer_set_slice(Buffer buffer,
|
||||
}
|
||||
|
||||
start = normalize_index(buf, start) + (include_start ? 0 : 1);
|
||||
include_end = include_end || (end >= buf->b_ml.ml_line_count);
|
||||
end = normalize_index(buf, end) + (include_end ? 1 : 0);
|
||||
|
||||
if (start > end) {
|
||||
|
Reference in New Issue
Block a user