def _text_to_vim(start, end, text):
 lines = text.split('\n')
 new_end = _calc_end(lines, start)
 before = _vim.buf[start.line][:start.col]
 after = _vim.buf[end.line][end.col:]
 new_lines = []
 if len(lines):
  new_lines.append((before + lines[0]))
  new_lines.extend(lines[1:])
  new_lines[(-1)] += after
 _vim.buf[start.line:(end.line + 1)] = new_lines
 _vim.buf.cursor = start
 _vim.command('normal! zv')
 return new_end

def _text_to_vim ( start , end , text ) : lines = text . split ( '\n' ) new_end = _calc_end ( lines , start ) before = _vim . buf [ start . line ] [ : start . col ] after = _vim . buf [ end . line ] [ end . col : ] new_lines = [ ] if len ( lines ) : new_lines . append ( ( before + lines [ 0 ] ) ) new_lines . extend ( lines [ 1 : ] ) new_lines [ ( - 1 ) ] += after _vim . buf [ start . line : ( end . line + 1 ) ] = new_lines _vim . buf . cursor = start _vim . command ( 'normal! zv' ) return new_end
copy the given text to the current buffer .