Skip to content

Commit 8e7436d

Browse files
committed
Update some API method names to reflect neovim/neovim#1257
1 parent b77e433 commit 8e7436d

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

neovim/api/buffer.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self, session, code_data):
2929

3030
def __len__(self):
3131
"""Return the number of lines contained in a Buffer."""
32-
return self._session.request('buffer_get_length', self)
32+
return self._session.request('buffer_line_count', self)
3333

3434
def __getitem__(self, idx):
3535
"""Get a buffer line or slice by integer index.
@@ -51,7 +51,7 @@ def __getitem__(self, idx):
5151
if end is None:
5252
end = -1
5353
include_end = True
54-
return self._session.request('buffer_get_slice', self, start, end,
54+
return self._session.request('buffer_get_line_slice', self, start, end,
5555
True, include_end)
5656

5757
def __setitem__(self, idx, lines):
@@ -78,7 +78,7 @@ def __setitem__(self, idx, lines):
7878
if end is None:
7979
end = -1
8080
include_end = True
81-
return self._session.request('buffer_set_slice', self, start, end,
81+
return self._session.request('buffer_set_line_slice', self, start, end,
8282
True, include_end, lines)
8383

8484
def __iter__(self):
@@ -93,15 +93,15 @@ def __iter__(self):
9393
for line in lines:
9494
yield line
9595

96-
def get_slice(self, start, stop, start_incl, end_incl):
96+
def get_line_slice(self, start, stop, start_incl, end_incl):
9797
"""More flexible wrapper for retrieving slices."""
98-
return self._session.request('buffer_get_slice', self, start, stop,
99-
start_incl, end_incl)
98+
return self._session.request('buffer_get_line_slice', self, start,
99+
stop, start_incl, end_incl)
100100

101-
def set_slice(self, start, stop, start_incl, end_incl, lines):
101+
def set_line_slice(self, start, stop, start_incl, end_incl, lines):
102102
"""More flexible wrapper for replacing slices."""
103-
return self._session.request('buffer_set_slice', self, start, stop,
104-
start_incl, end_incl, lines)
103+
return self._session.request('buffer_set_line_slice', self, start,
104+
stop, start_incl, end_incl, lines)
105105

106106
def append(self, lines, index=-1):
107107
"""Append a string or list of lines to the buffer."""

neovim/plugins/script_host.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ def python_do_range(self, start, stop, code):
5454
# which can be done very quickly in a single API call.
5555
sstart = start
5656
sstop = min(start + 5000, stop)
57-
lines = nvim.current.buffer.get_slice(sstart, sstop, True, True)
57+
lines = nvim.current.buffer.get_line_slice(sstart, sstop, True, True)
5858
for i, line in enumerate(lines):
5959
linenr = i + sstart + 1
6060
result = str(function(line, linenr))
6161
if result:
6262
lines[i] = result
6363
start = sstop + 1
64-
nvim.current.buffer.set_slice(sstart, sstop, True, True, lines)
64+
nvim.current.buffer.set_line_slice(sstart, sstop, True, True, lines)
6565
# delete the function
6666
del self.module.__dict__[fname]
6767

0 commit comments

Comments
 (0)