Skip to content

Commit

Permalink
Merge pull request #220 from bfredl/append_bytes
Browse files Browse the repository at this point in the history
Buffer: allow bytes to append
  • Loading branch information
bfredl authored Aug 28, 2016
2 parents 9ac47fb + 1954384 commit b8bb7c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion neovim/api/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def set_line_slice(self, start, stop, start_incl, end_incl, lines):

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

Expand Down
2 changes: 2 additions & 0 deletions test/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def test_append():
eq(vim.current.buffer[:], ['b', '', 'a', 'c', 'd'])
vim.current.buffer.append(['c', 'd'], 2)
eq(vim.current.buffer[:], ['b', '', 'c', 'd', 'a', 'c', 'd'])
vim.current.buffer.append(b'bytes')
eq(vim.current.buffer[:], ['b', '', 'c', 'd', 'a', 'c', 'd', 'bytes'])


@with_setup(setup=cleanup)
Expand Down

0 comments on commit b8bb7c2

Please sign in to comment.