This commit is contained in:
Kovid Goyal
2021-07-12 18:34:43 +05:30
parent d4dd226d8f
commit 4a9a021b2c
4 changed files with 25 additions and 21 deletions

View File

@@ -141,10 +141,7 @@ void
linebuf_init_line(LineBuf *self, index_type idx) {
self->line->ynum = idx;
self->line->xnum = self->xnum;
self->line->continued = self->line_attrs[idx] & CONTINUED_MASK ? true : false;
self->line->has_dirty_text = self->line_attrs[idx] & TEXT_DIRTY_MASK ? true : false;
self->line->is_prompt_start = self->line_attrs[idx] & PROMPT_START_MASK ? true : false;
self->line->is_output_start = self->line_attrs[idx] & OUTPUT_START_MASK ? true : false;
copy_line_attrs_to_line(self->line_attrs[idx], self->line);
init_line(self, self->line, self->line_map[idx]);
}
@@ -232,10 +229,7 @@ create_line_copy_inner(LineBuf* self, index_type y) {
src.xnum = self->xnum; line->xnum = self->xnum;
if (!allocate_line_storage(line, 0)) { Py_CLEAR(line); return PyErr_NoMemory(); }
line->ynum = y;
line->continued = self->line_attrs[y] & CONTINUED_MASK ? true : false;
line->has_dirty_text = self->line_attrs[y] & TEXT_DIRTY_MASK ? true : false;
line->is_output_start = self->line_attrs[y] & OUTPUT_START_MASK ? true : false;
line->is_prompt_start = self->line_attrs[y] & PROMPT_START_MASK ? true : false;
copy_line_attrs_to_line(self->line_attrs[y], line);
init_line(self, &src, self->line_map[y]);
copy_line(&src, line);
return (PyObject*)line;
@@ -257,10 +251,7 @@ copy_line_to(LineBuf *self, PyObject *args) {
if (!PyArg_ParseTuple(args, "IO!", &y, &Line_Type, &dest)) return NULL;
src.xnum = self->xnum; dest->xnum = self->xnum;
dest->ynum = y;
dest->continued = self->line_attrs[y] & CONTINUED_MASK;
dest->has_dirty_text = self->line_attrs[y] & TEXT_DIRTY_MASK;
dest->is_output_start = self->line_attrs[y] & OUTPUT_START_MASK;
dest->is_prompt_start = self->line_attrs[y] & PROMPT_START_MASK;
copy_line_attrs_to_line(self->line_attrs[y], dest);
init_line(self, &src, self->line_map[y]);
copy_line(&src, dest);
Py_RETURN_NONE;
@@ -419,7 +410,7 @@ void
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[where] = TEXT_DIRTY_MASK | (line->continued ? CONTINUED_MASK : 0) | (line->is_output_start ? OUTPUT_START_MASK : 0) | (line->is_prompt_start ? PROMPT_START_MASK : 0);
self->line_attrs[where] = TEXT_DIRTY_MASK | line_attrs_from_line(line);
}
static PyObject*