Make the code to copy lines into linebufs general

This commit is contained in:
Kovid Goyal 2021-03-17 22:02:47 +05:30
parent 0f3ff4e2d9
commit d743aff4bc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 5 additions and 5 deletions

View File

@ -406,10 +406,10 @@ delete_lines(LineBuf *self, PyObject *args) {
}
void
linebuf_add_line_to_top(LineBuf *self, Line *line) {
init_line(self, self->line, self->line_map[0]);
linebuf_copy_line_to(LineBuf *self, Line *line, index_type where) {
init_line(self, self->line, self->line_map[where]);
copy_line(line, self->line);
self->line_attrs[0] = TEXT_DIRTY_MASK | (line->continued ? CONTINUED_MASK : 0);
self->line_attrs[where] = TEXT_DIRTY_MASK | (line->continued ? CONTINUED_MASK : 0);
}
static PyObject*

View File

@ -94,7 +94,7 @@ void linebuf_clear_line(LineBuf *self, index_type y);
unsigned int linebuf_continued_lines_count(const LineBuf *, const index_type);
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_copy_line_to(LineBuf *, Line *, index_type);
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);

View File

@ -329,7 +329,7 @@ screen_resize(Screen *self, unsigned int lines, unsigned int columns) {
while (lines_to_fill-- > 0) {
if (!historybuf_pop_line(self->historybuf, self->alt_linebuf->line)) break;
INDEX_DOWN;
linebuf_add_line_to_top(self->main_linebuf, self->alt_linebuf->line);
linebuf_copy_line_to(self->main_linebuf, self->alt_linebuf->line, 0);
}
}
return true;