'This displays the line editor buffer, or selected parts of it.
Args:
buf (str, optional): The buffer or part of buffer to display.
offset (int, optional): If `buf` is set and is not the full buffer,
`offset` should define the actual starting line number, to
get the linenum display right.
linenums (bool, optional): Show line numbers in buffer.
options: raw (bool, optional): Tell protocol to not parse
formatting information.'

def display_buffer(self, buf=None, offset=0, linenums=True, options={'raw': False}):

    if (buf is None):
        buf = self._buffer
    if is_iter(buf):
        buf = '\n'.join(buf)
    lines = buf.split('\n')
    nlines = len(lines)
    nwords = len(buf.split())
    nchars = len(buf)
    sep = self._sep
    header = ((('|n' + (sep * 10)) + ('Line    Editor    [%s]' % self._key)) + (sep * ((_DEFAULT_WIDTH - 20) - len(self._key))))
    footer = ((((('|n' + (sep * 10)) + ('[l:%02i    w:%03i    c:%04i]' % (nlines, nwords, nchars))) + (sep * 12)) + '(:h    for    help)') + (sep * 28))
    if linenums:
        main = '\n'.join((('|b%02i|||n    %s' % (((iline + 1) + offset), raw(line))) for (iline, line) in enumerate(lines)))
    else:
        main = '\n'.join([raw(line) for line in lines])
    string = ('%s\n%s\n%s' % (header, main, footer))
    self._caller.msg(string, options=options)
