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:
Thiago de Arruda
2014-06-30 19:03:46 -03:00
parent fba1d3b50f
commit 83cad98d5d

View File

@@ -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) {