aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/buffer.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 9c58baca39..21bfc5ede0 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -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) {