diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-30 19:03:46 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-07-17 11:37:41 -0300 |
commit | 83cad98d5d4272adfc97f7c2cab0673b7d29a0a0 (patch) | |
tree | 6b4b59b453133cdb352bf057a67930b140ab73ac /src/nvim/api/buffer.c | |
parent | fba1d3b50f34a4e755bee8fa5dcc192efef202d8 (diff) | |
download | rneovim-83cad98d5d4272adfc97f7c2cab0673b7d29a0a0.tar.gz rneovim-83cad98d5d4272adfc97f7c2cab0673b7d29a0a0.tar.bz2 rneovim-83cad98d5d4272adfc97f7c2cab0673b7d29a0a0.zip |
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
Diffstat (limited to 'src/nvim/api/buffer.c')
-rw-r--r-- | src/nvim/api/buffer.c | 2 |
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) { |