Skip to content

Commit b8bb7c2

Browse files
authored
Merge pull request #220 from bfredl/append_bytes
Buffer: allow bytes to append
2 parents 9ac47fb + 1954384 commit b8bb7c2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Diff for: neovim/api/buffer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def set_line_slice(self, start, stop, start_incl, end_incl, lines):
104104

105105
def append(self, lines, index=-1):
106106
"""Append a string or list of lines to the buffer."""
107-
if isinstance(lines, basestring):
107+
if isinstance(lines, (basestring, bytes)):
108108
lines = [lines]
109109
return self._session.request('buffer_insert', self, index, lines)
110110

Diff for: test/test_buffer.py

+2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ def test_append():
140140
eq(vim.current.buffer[:], ['b', '', 'a', 'c', 'd'])
141141
vim.current.buffer.append(['c', 'd'], 2)
142142
eq(vim.current.buffer[:], ['b', '', 'c', 'd', 'a', 'c', 'd'])
143+
vim.current.buffer.append(b'bytes')
144+
eq(vim.current.buffer[:], ['b', '', 'c', 'd', 'a', 'c', 'd', 'bytes'])
143145

144146

145147
@with_setup(setup=cleanup)

0 commit comments

Comments
 (0)