mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Merge SIXEL branch.
Squashed commit of the following: commit 6ebc3feb4671d9b25b3db99d3c16b2323b8e3d02 Author: topcat001 <anindya49@hotmail.com> Date: Sun Aug 20 16:09:51 2023 -0700 Remove redundant {}. commit 6f013fce39602c259a5be2d690d548c73e51cccc Author: topcat001 <anindya49@hotmail.com> Date: Sun Aug 20 16:02:15 2023 -0700 Revert "Do not defer redraw if it is just the status line (will need to do more here I" This reverts commit0a15bbf3f1
. commit e6322b4196d73c975ba2e73633e6de9c46779059 Author: topcat001 <anindya49@hotmail.com> Date: Sun Aug 20 15:46:59 2023 -0700 Fix placeholder label and clean up. commit 5896ac52a1f72056a75480b3e1ada328f239df9b Merge: ad982330e3a8b843
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Fri Aug 18 17:00:03 2023 +0100 Merge branch 'master' into sixel commit ad98233066b72547aee7fa0c87838847ee7f1ece Author: topcat001 <anindya49@hotmail.com> Date: Tue Aug 15 13:57:08 2023 -0700 Better text placeholder. commit 312d83252c27fc4d09d09d121bf7573336e3cdca Merge: 14b8b5243d93b0c5
Author: topcat001 <anindya49@hotmail.com> Date: Tue Aug 15 13:39:22 2023 -0700 Merge remote-tracking branch 'origin/master' into sixel commit 14b8b524523a7d5a4e42f7dfa346905c604c91e2 Merge: 4baf7642fda39377
Author: topcat001 <anindya49@hotmail.com> Date: Sat Jul 22 17:29:10 2023 -0700 Merge branch 'master' into sixel commit 4baf76422fadb216bf27b47645b52da3379e7dea Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Jun 21 07:43:53 2023 +0100 Both files can go on one line. commit4c92acf6ff
Author: topcat001 <anindya49@hotmail.com> Date: Sat Jun 17 17:53:01 2023 -0700 Merge topcat001/tmux/sixel. commit6794facc82
Merge: 7b85f5adf41c536f
Author: topcat001 <anindya49@hotmail.com> Date: Sat Jun 17 17:21:02 2023 -0700 Merge remote-tracking branch 'origin/master' into sixel commit 7b85f5adf9a5094db580ca98e4d2231d8d5b5a4f Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jun 8 12:55:03 2023 +0100 Do not require passthrough for SIXEL. commit a6ee55e0925cac35d011c188db2da0421fc09be1 Merge: 6da391f4fe385b18
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jun 8 12:19:55 2023 +0100 Merge branch 'master' into sixel commit 6da391f460414ed3dde23e5ab6ca3fe8e988ce51 Merge: 0d71e5850eb5d254
Author: topcat001 <anindya49@hotmail.com> Date: Sat May 20 17:05:55 2023 -0700 Merge branch 'master' into sixel commit 0d71e5853ffe797f90b815ac3af25ac0ad92ab07 Merge:64368a1a
fbe6fe7f
Author: topcat001 <anindya49@hotmail.com> Date: Sat Apr 29 17:32:07 2023 -0700 Merge branch 'master' into sixel commit64368a1a63
Merge:c630a56a
22eb0334
Author: topcat001 <anindya49@hotmail.com> Date: Thu Mar 30 14:21:09 2023 -0700 Merge branch 'master' into sixel commitc630a56a62
Merge:34c96c4c
aaa043a2
Author: topcat001 <anindya49@hotmail.com> Date: Thu Nov 10 18:53:01 2022 -0800 Merge branch 'master' into sixel commit34c96c4c4a
Merge:2a1e16a2
50f4e0fa
Author: topcat001 <anindya49@hotmail.com> Date: Sat Nov 5 18:05:36 2022 -0700 Merge branch 'master' into sixel commit2a1e16a24d
Merge:a82f14c7
d001a94d
Author: topcat001 <anindya49@hotmail.com> Date: Thu Oct 27 16:01:35 2022 -0700 Merge branch 'master' into sixel commita82f14c7b2
Merge:742c0634
f7b30ed3
Author: topcat001 <anindya49@hotmail.com> Date: Sun Aug 28 13:43:07 2022 -0700 Merge branch 'master' into sixel commit742c063473
Merge:906c92a5
87b248f3
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Fri Apr 1 10:14:15 2022 +0100 Merge branch 'master' into sixel commit906c92a5f4
Merge:6680a024
138ffc7c
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 8 10:37:33 2021 +0000 Merge branch 'master' into sixel commit6680a024be
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Oct 7 13:59:08 2021 +0100 Fix build. commitebd2c58593
Merge:90dc0519
fed7b29c
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Oct 7 13:19:48 2021 +0100 Merge branch 'master' into sixel commit90dc05191c
Merge:a282439f
4694afbe
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Feb 20 20:37:32 2020 +0000 Merge branch 'master' into sixel commita282439fcb
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jan 30 09:12:53 2020 +0000 Add missing declarations. commit3a741aacd1
Merge:40ad0107
339832b9
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jan 30 09:11:01 2020 +0000 Merge branch 'sixel-passthrough' into sixel commit339832b92c
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jan 30 09:04:51 2020 +0000 Bad merge. commit92ed9fc0b2
Merge:5bb07548
32be954b
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Jan 30 09:03:38 2020 +0000 Merge branch 'master' into sixel-passthrough commit40ad01073d
Merge:dd3c72f1
61b075a2
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sun Jan 12 20:03:41 2020 +0000 Merge branch 'master' into sixel commit5bb075487f
Merge:7c033a74
54efe337
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 18 20:24:42 2019 +0000 Merge branch 'master' into sixel-passthrough commitdd3c72f132
Merge:1a0e5fe9
54efe337
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 18 20:24:26 2019 +0000 Merge branch 'master' into sixel commit1a0e5fe933
Merge:cf071ffe
15d7e564
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Tue Dec 10 16:34:11 2019 +0000 Merge branch 'master' into sixel commitcf071ffecd
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Mon Dec 9 15:41:56 2019 +0000 Remove images when reflow happens. commit2006b7a563
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 09:27:15 2019 +0000 More invalidation of images. commitb642eac450
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 09:11:24 2019 +0000 Redraw and scroll images and part of invalidating them. commit7566e37a46
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 08:51:24 2019 +0000 Call sixel_scale with the right number of arguments. commit62c0280b23
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 08:48:58 2019 +0000 Correctly remove when not visible. commit86c5098a88
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 08:32:25 2019 +0000 Add helpers to scroll image up and a flag to copy the colours. commit49f2f0a8f1
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Dec 5 00:02:55 2019 +0000 Store images, currently at most 10. commit3aebcc6709
Merge:146ee3f6
92ecd611
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 4 19:27:16 2019 +0000 Merge branch 'master' into sixel commit7c033a74e2
Merge:0a15bbf3
92ecd611
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Wed Dec 4 12:41:09 2019 +0000 Merge branch 'master' into sixel-passthrough commit146ee3f6f8
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sat Nov 30 09:47:53 2019 +0000 Don't write image as text yet. commit0a15bbf3f1
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sat Nov 30 09:15:35 2019 +0000 Do not defer redraw if it is just the status line (will need to do more here I think). commita5b1e20941
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 14:20:22 2019 +0000 Add a flag to disable blocking while sending a SIXEL image (turned off when the buffer hits 0 size). commit968382aa6a
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 12:35:18 2019 +0000 Pass through SIXEL DCS sequences (treat similarly to the passthrough escape sequence) if it appears the terminal outside supports them. commitb1904c9b8d
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sat Nov 30 09:17:18 2019 +0000 Store SIXELs as a box for the moment. commit5d8dbcdf3d
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Sat Nov 30 09:15:35 2019 +0000 Do not defer redraw if it is just the status line (will need to do more here I think). commit0c999a402e
Merge:28961dd5
866b053f
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Fri Nov 29 18:54:09 2019 +0000 Merge branch 'master' into sixel commit28961dd5a3
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 14:24:57 2019 +0000 Add an image. commitd2e3f3c1cc
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 14:20:22 2019 +0000 Add a flag to disable blocking while sending a SIXEL image (turned off when the buffer hits 0 size). commite01df67ca1
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 13:21:40 2019 +0000 Crop and scale images as needed when drawing them. commite24acc0b5c
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 12:38:02 2019 +0000 Simple SIXEL parse and modify API. commitb34111b3da
Author: Nicholas Marriott <nicholas.marriott@gmail.com> Date: Thu Nov 28 12:35:18 2019 +0000 Pass through SIXEL DCS sequences (treat similarly to the passthrough escape sequence) if it appears the terminal outside supports them.
This commit is contained in:
156
screen-write.c
156
screen-write.c
@ -1011,6 +1011,11 @@ screen_write_alignmenttest(struct screen_write_ctx *ctx)
|
||||
memcpy(&gc, &grid_default_cell, sizeof gc);
|
||||
utf8_set(&gc.data, 'E');
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_free_all(s) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
for (yy = 0; yy < screen_size_y(s); yy++) {
|
||||
for (xx = 0; xx < screen_size_x(s); xx++)
|
||||
grid_view_set_cell(s->grid, xx, yy, &gc);
|
||||
@ -1045,6 +1050,11 @@ screen_write_insertcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
||||
if (s->cx > screen_size_x(s) - 1)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, 1) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx, 0);
|
||||
ttyctx.bg = bg;
|
||||
|
||||
@ -1073,6 +1083,11 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
||||
if (s->cx > screen_size_x(s) - 1)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, 1) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx, 0);
|
||||
ttyctx.bg = bg;
|
||||
|
||||
@ -1101,6 +1116,11 @@ screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
||||
if (s->cx > screen_size_x(s) - 1)
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, 1) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx, 0);
|
||||
ttyctx.bg = bg;
|
||||
|
||||
@ -1119,9 +1139,18 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
||||
struct grid *gd = s->grid;
|
||||
struct tty_ctx ttyctx;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
u_int sy = screen_size_y(s);
|
||||
#endif
|
||||
|
||||
if (ny == 0)
|
||||
ny = 1;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, sy - s->cy) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
if (s->cy < s->rupper || s->cy > s->rlower) {
|
||||
if (ny > screen_size_y(s) - s->cy)
|
||||
ny = screen_size_y(s) - s->cy;
|
||||
@ -1165,13 +1194,19 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
||||
struct screen *s = ctx->s;
|
||||
struct grid *gd = s->grid;
|
||||
struct tty_ctx ttyctx;
|
||||
u_int sy = screen_size_y(s);
|
||||
|
||||
if (ny == 0)
|
||||
ny = 1;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, sy - s->cy) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
if (s->cy < s->rupper || s->cy > s->rlower) {
|
||||
if (ny > screen_size_y(s) - s->cy)
|
||||
ny = screen_size_y(s) - s->cy;
|
||||
if (ny > sy - s->cy)
|
||||
ny = sy - s->cy;
|
||||
if (ny == 0)
|
||||
return;
|
||||
|
||||
@ -1217,6 +1252,11 @@ screen_write_clearline(struct screen_write_ctx *ctx, u_int bg)
|
||||
if (gl->cellsize == 0 && COLOUR_DEFAULT(bg))
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, 1) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
grid_view_clear(s->grid, 0, s->cy, sx, 1, bg);
|
||||
|
||||
screen_write_collect_clear(ctx, s->cy, 1);
|
||||
@ -1246,6 +1286,11 @@ screen_write_clearendofline(struct screen_write_ctx *ctx, u_int bg)
|
||||
if (s->cx > sx - 1 || (s->cx >= gl->cellsize && COLOUR_DEFAULT(bg)))
|
||||
return;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, 1) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1, bg);
|
||||
|
||||
before = screen_write_collect_trim(ctx, s->cy, s->cx, sx - s->cx, NULL);
|
||||
@ -1273,6 +1318,11 @@ screen_write_clearstartofline(struct screen_write_ctx *ctx, u_int bg)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, 1) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
if (s->cx > sx - 1)
|
||||
grid_view_clear(s->grid, 0, s->cy, sx, 1, bg);
|
||||
else
|
||||
@ -1320,6 +1370,11 @@ screen_write_reverseindex(struct screen_write_ctx *ctx, u_int bg)
|
||||
struct screen *s = ctx->s;
|
||||
struct tty_ctx ttyctx;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_free_all(s) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
if (s->cy == s->rupper) {
|
||||
grid_view_scroll_region_down(s->grid, s->rupper, s->rlower, bg);
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
@ -1363,13 +1418,15 @@ screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped, u_int bg)
|
||||
struct screen *s = ctx->s;
|
||||
struct grid *gd = s->grid;
|
||||
struct grid_line *gl;
|
||||
int redraw = 0;
|
||||
u_int rupper = s->rupper, rlower = s->rlower;
|
||||
|
||||
gl = grid_get_line(gd, gd->hsize + s->cy);
|
||||
if (wrapped)
|
||||
gl->flags |= GRID_LINE_WRAPPED;
|
||||
|
||||
log_debug("%s: at %u,%u (region %u-%u)", __func__, s->cx, s->cy,
|
||||
s->rupper, s->rlower);
|
||||
rupper, rlower);
|
||||
|
||||
if (bg != ctx->bg) {
|
||||
screen_write_collect_flush(ctx, 1, __func__);
|
||||
@ -1377,6 +1434,14 @@ screen_write_linefeed(struct screen_write_ctx *ctx, int wrapped, u_int bg)
|
||||
}
|
||||
|
||||
if (s->cy == s->rlower) {
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (rlower == screen_size_y(s) - 1)
|
||||
redraw = image_scroll_up(s, 1);
|
||||
else
|
||||
redraw = image_check_line(s, rupper, rlower - rupper);
|
||||
if (redraw && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
grid_view_scroll_region_up(gd, s->rupper, s->rlower, bg);
|
||||
screen_write_collect_scroll(ctx, bg);
|
||||
ctx->scrolled++;
|
||||
@ -1402,6 +1467,11 @@ screen_write_scrollup(struct screen_write_ctx *ctx, u_int lines, u_int bg)
|
||||
ctx->bg = bg;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_scroll_up(s, lines) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < lines; i++) {
|
||||
grid_view_scroll_region_up(gd, s->rupper, s->rlower, bg);
|
||||
screen_write_collect_scroll(ctx, bg);
|
||||
@ -1426,6 +1496,11 @@ screen_write_scrolldown(struct screen_write_ctx *ctx, u_int lines, u_int bg)
|
||||
else if (lines > s->rlower - s->rupper + 1)
|
||||
lines = s->rlower - s->rupper + 1;
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_free_all(s) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < lines; i++)
|
||||
grid_view_scroll_region_down(gd, s->rupper, s->rlower, bg);
|
||||
|
||||
@ -1450,6 +1525,11 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
|
||||
struct tty_ctx ttyctx;
|
||||
u_int sx = screen_size_x(s), sy = screen_size_y(s);
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, s->cy, sy - s->cy) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx, 1);
|
||||
ttyctx.bg = bg;
|
||||
|
||||
@ -1479,6 +1559,11 @@ screen_write_clearstartofscreen(struct screen_write_ctx *ctx, u_int bg)
|
||||
struct tty_ctx ttyctx;
|
||||
u_int sx = screen_size_x(s);
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_line(s, 0, s->cy - 1) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx, 1);
|
||||
ttyctx.bg = bg;
|
||||
|
||||
@ -1502,6 +1587,11 @@ screen_write_clearscreen(struct screen_write_ctx *ctx, u_int bg)
|
||||
struct tty_ctx ttyctx;
|
||||
u_int sx = screen_size_x(s), sy = screen_size_y(s);
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_free_all(s) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx, 1);
|
||||
ttyctx.bg = bg;
|
||||
|
||||
@ -1770,6 +1860,11 @@ screen_write_collect_end(struct screen_write_ctx *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
if (image_check_area(s, s->cx, s->cy, ci->used, 1) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
#endif
|
||||
|
||||
grid_view_set_cells(s->grid, s->cx, s->cy, &ci->gc, cl->data + ci->x,
|
||||
ci->used);
|
||||
screen_write_set_cursor(ctx, s->cx + ci->used, -1);
|
||||
@ -2157,6 +2252,61 @@ screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len,
|
||||
tty_write(tty_cmd_rawstring, &ttyctx);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SIXEL
|
||||
/* Write a SIXEL image. */
|
||||
void
|
||||
screen_write_sixelimage(struct screen_write_ctx *ctx, struct sixel_image *si,
|
||||
u_int bg)
|
||||
{
|
||||
struct screen *s = ctx->s;
|
||||
struct grid *gd = s->grid;
|
||||
struct tty_ctx ttyctx;
|
||||
u_int x, y, sx, sy, cx = s->cx, cy = s->cy, i, lines;
|
||||
struct sixel_image *new;
|
||||
|
||||
sixel_size_in_cells(si, &x, &y);
|
||||
if (x > screen_size_x(s) || y > screen_size_y(s)) {
|
||||
if (x > screen_size_x(s) - cx)
|
||||
sx = screen_size_x(s) - cx;
|
||||
else
|
||||
sx = x;
|
||||
if (y > screen_size_y(s) - 1)
|
||||
sy = screen_size_y(s) - 1;
|
||||
else
|
||||
sy = y;
|
||||
new = sixel_scale(si, 0, 0, 0, y - sy, sx, sy, 1);
|
||||
sixel_free(si);
|
||||
si = new;
|
||||
sixel_size_in_cells(si, &x, &y);
|
||||
}
|
||||
|
||||
sy = screen_size_y(s) - cy;
|
||||
if (sy < y) {
|
||||
lines = y - sy + 1;
|
||||
if (image_scroll_up(s, lines) && ctx->wp != NULL)
|
||||
ctx->wp->flags |= PANE_REDRAW;
|
||||
for (i = 0; i < lines; i++) {
|
||||
grid_view_scroll_region_up(gd, 0, screen_size_y(s) - 1,
|
||||
bg);
|
||||
screen_write_collect_scroll(ctx, bg);
|
||||
}
|
||||
ctx->scrolled += lines;
|
||||
if (lines > cy)
|
||||
screen_write_cursormove(ctx, -1, 0, 0);
|
||||
else
|
||||
screen_write_cursormove(ctx, -1, cy - lines, 0);
|
||||
}
|
||||
screen_write_collect_flush(ctx, 0, __func__);
|
||||
|
||||
screen_write_initctx(ctx, &ttyctx, 0);
|
||||
ttyctx.ptr = image_store(s, si);
|
||||
|
||||
tty_write(tty_cmd_sixelimage, &ttyctx);
|
||||
|
||||
screen_write_cursormove(ctx, 0, cy + y, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Turn alternate screen on. */
|
||||
void
|
||||
screen_write_alternateon(struct screen_write_ctx *ctx, struct grid_cell *gc,
|
||||
|
Reference in New Issue
Block a user