Skip to content

Commit

Permalink
Buffer: allow bytes to append
Browse files Browse the repository at this point in the history
  • Loading branch information
bfredl committed Aug 28, 2016
1 parent 4280e49 commit 1954384
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 1954384

Please sign in to comment.