From c93c87e8fed088a24d53d778608e115aff1a5e37 Mon Sep 17 00:00:00 2001 From: Eddie Lebow Date: Thu, 11 Mar 2021 02:01:56 -0500 Subject: [PATCH] Add linebuf_add_line_to_top() --- kitty/line-buf.c | 7 +++++++ kitty/lineops.h | 1 + 2 files changed, 8 insertions(+) diff --git a/kitty/line-buf.c b/kitty/line-buf.c index 1a2cb4904..434d813d9 100644 --- a/kitty/line-buf.c +++ b/kitty/line-buf.c @@ -396,6 +396,13 @@ delete_lines(LineBuf *self, PyObject *args) { Py_RETURN_NONE; } +void +linebuf_add_line_to_top(LineBuf *self, Line *line) { + init_line(self, self->line, self->line_map[0]); + copy_line(line, self->line); + self->line_attrs[0] = TEXT_DIRTY_MASK | (line->continued ? CONTINUED_MASK : 0); +} + static PyObject* as_ansi(LineBuf *self, PyObject *callback) { #define as_ansi_doc "as_ansi(callback) -> The contents of this buffer as ANSI escaped text. callback is called with each successive line." diff --git a/kitty/lineops.h b/kitty/lineops.h index c1ba8c24c..6c58f61dd 100644 --- a/kitty/lineops.h +++ b/kitty/lineops.h @@ -93,6 +93,7 @@ void linebuf_reverse_index(LineBuf *self, index_type top, index_type bottom); void linebuf_clear_line(LineBuf *self, index_type y); void linebuf_insert_lines(LineBuf *self, unsigned int num, unsigned int y, unsigned int bottom); void linebuf_delete_lines(LineBuf *self, index_type num, index_type y, index_type bottom); +void linebuf_add_line_to_top(LineBuf *, Line *); void linebuf_set_attribute(LineBuf *, unsigned int , unsigned int ); void linebuf_rewrap(LineBuf *self, LineBuf *other, index_type *, index_type *, HistoryBuf *, index_type *, index_type *, ANSIBuf*); void linebuf_mark_line_dirty(LineBuf *self, index_type y);