Fix copy ansi to clipboard ignoring newlines

This commit is contained in:
Kovid Goyal
2022-02-13 15:09:14 +05:30
parent 5f8cb22d02
commit a4abe26d32
5 changed files with 12 additions and 13 deletions

View File

@@ -413,7 +413,7 @@ as_ansi(LineBuf *self, PyObject *callback) {
ANSIBuf output = {0};
do {
init_line(self, (&l), self->line_map[ylimit]);
line_as_ansi(&l, &output, &prev_cell, 0, l.xnum);
line_as_ansi(&l, &output, &prev_cell, 0, l.xnum, 0);
if (output.len) break;
ylimit--;
} while(ylimit > 0);
@@ -421,7 +421,7 @@ as_ansi(LineBuf *self, PyObject *callback) {
for(index_type i = 0; i <= ylimit; i++) {
l.attrs.continued = self->line_attrs[(i + 1 < self->ynum) ? i+1 : i].continued;
init_line(self, (&l), self->line_map[i]);
line_as_ansi(&l, &output, &prev_cell, 0, l.xnum);
line_as_ansi(&l, &output, &prev_cell, 0, l.xnum, 0);
if (!l.attrs.continued) {
ensure_space_for(&output, buf, Py_UCS4, output.len + 1, capacity, 2048, false);
output.buf[output.len++] = 10; // 10 = \n