Finish up the redraw multicell tests

This commit is contained in:
Kovid Goyal
2024-12-30 06:41:09 +05:30
parent 001cc8009e
commit b3c39f4921
3 changed files with 20 additions and 8 deletions

View File

@@ -11,8 +11,7 @@
// TODO: Handle selection with multicell
// TODO: URL detection with multicell
// TODO: Handle rewrap and restitch of multiline chars
// TODO: Handle rewrap when a character is too wide/tall to fit on resized screen
// TODO: Handle restitch of multiline chars
typedef union CellAttrs {
struct {

View File

@@ -219,19 +219,19 @@ fast_copy_src_to_dest(Rewrap *r) {
}
}
index_type num = MIN(r->src_x_limit - r->src_x, r->dest_xnum - r->dest_x);
bool do_copy = true;
if (num && (c = &r->src.cpu_cells[r->src_x + num - 1])->is_multicell && c->x != (mc_width = mcd_x_limit(c)) - 1) {
// we have a split multicell at the right edge of the copy region
if (num > mc_width) num = MIN(r->src_x_limit - r->src_x - mc_width, num);
else {
if (mc_width > r->dest_xnum) do_copy = false;
else {
r->dest_x = r->dest_xnum;
continue;
if (mc_width > r->dest_xnum) {
multiline_copy_src_to_dest(r);
return;
}
r->dest_x = r->dest_xnum;
continue;
}
}
if (do_copy) copy_range(&r->src, r->src_x, &r->dest, r->dest_x, num);
copy_range(&r->src, r->src_x, &r->dest, r->dest_x, num);
update_tracked_cursors(r, num, r->src_y, r->src_x_limit);
r->src_x += num; r->dest_x += num;
}