mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 14:16:18 +00:00
Merge branch 'obsd-master'
This commit is contained in:
@@ -1351,12 +1351,13 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
|
|||||||
ri = &r->ranges[k];
|
ri = &r->ranges[k];
|
||||||
if (ri->nx == 0)
|
if (ri->nx == 0)
|
||||||
continue;
|
continue;
|
||||||
log_debug("%s: %s %%%u range pane (%u,%u) width %u, tty (%u,%u) width %u",
|
log_debug("%s: %s %%%u range %u (%u,%u) width %u, "
|
||||||
__func__, c->name, wp->id,
|
"tty (%u,%u) width %u",
|
||||||
|
__func__, c->name, wp->id, k,
|
||||||
ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
|
ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
|
||||||
ri->px, py, ri->nx);
|
ri->px, py, ri->nx);
|
||||||
tty_draw_line(tty, s, ri->px + (int)ctx->ox - wp->xoff, j, ri->nx,
|
tty_draw_line(tty, s, ri->px + (int)ctx->ox - wp->xoff,
|
||||||
ri->px, py, &defaults, palette);
|
j, ri->nx, ri->px, py, &defaults, palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1127,7 +1127,7 @@ screen_write_redraw_line(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
|
|||||||
{
|
{
|
||||||
struct window_pane *wp = ctx->wp;
|
struct window_pane *wp = ctx->wp;
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
struct grid_cell gc;
|
struct grid_cell gc, ngc;
|
||||||
u_int sx = screen_size_x(s), cx, i, n;
|
u_int sx = screen_size_x(s), cx, i, n;
|
||||||
u_int xoff = wp->xoff, yoff = wp->yoff;
|
u_int xoff = wp->xoff, yoff = wp->yoff;
|
||||||
struct visible_ranges *r;
|
struct visible_ranges *r;
|
||||||
@@ -1142,9 +1142,15 @@ screen_write_redraw_line(struct screen_write_ctx *ctx, struct tty_ctx *ttyctx,
|
|||||||
cx = ri->px - xoff;
|
cx = ri->px - xoff;
|
||||||
for (n = 0; n < ri->nx && cx < sx; n++, cx++) {
|
for (n = 0; n < ri->nx && cx < sx; n++, cx++) {
|
||||||
grid_view_get_cell(s->grid, cx, yy, &gc);
|
grid_view_get_cell(s->grid, cx, yy, &gc);
|
||||||
|
if (~gc.flags & GRID_FLAG_SELECTED)
|
||||||
|
ttyctx->cell = &gc;
|
||||||
|
else {
|
||||||
|
screen_select_cell(s, &ngc, &gc);
|
||||||
|
ttyctx->cell = &ngc;
|
||||||
|
}
|
||||||
|
|
||||||
ttyctx->ocx = cx;
|
ttyctx->ocx = cx;
|
||||||
ttyctx->ocy = yy;
|
ttyctx->ocy = yy;
|
||||||
ttyctx->cell = &gc;
|
|
||||||
tty_write(tty_cmd_cell, ttyctx);
|
tty_write(tty_cmd_cell, ttyctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2353,6 +2359,7 @@ void
|
|||||||
screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
|
struct window_pane *wp = ctx->wp;
|
||||||
struct grid *gd = s->grid;
|
struct grid *gd = s->grid;
|
||||||
const struct utf8_data *ud = &gc->data;
|
const struct utf8_data *ud = &gc->data;
|
||||||
struct grid_line *gl;
|
struct grid_line *gl;
|
||||||
@@ -2360,8 +2367,10 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
struct grid_cell tmp_gc, now_gc;
|
struct grid_cell tmp_gc, now_gc;
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
u_int sx = screen_size_x(s), sy = screen_size_y(s);
|
u_int sx = screen_size_x(s), sy = screen_size_y(s);
|
||||||
u_int width = ud->width, xx, not_wrap;
|
u_int width = ud->width, xx, not_wrap, i, n, vis;
|
||||||
int selected, skip = 1, redraw = 0;
|
int selected, skip = 1, redraw = 0, yoff = 0;
|
||||||
|
struct visible_ranges *r;
|
||||||
|
struct visible_range *ri;
|
||||||
|
|
||||||
/* Ignore padding cells. */
|
/* Ignore padding cells. */
|
||||||
if (gc->flags & GRID_FLAG_PADDING)
|
if (gc->flags & GRID_FLAG_PADDING)
|
||||||
@@ -2459,6 +2468,12 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
if (selected)
|
if (selected)
|
||||||
skip = 0;
|
skip = 0;
|
||||||
|
|
||||||
|
/* Get visible ranges for the character before moving the cursor. */
|
||||||
|
if (wp != NULL)
|
||||||
|
yoff = wp->yoff;
|
||||||
|
r = screen_redraw_get_visible_ranges(wp, s->cx, s->cy + yoff, width,
|
||||||
|
NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Move the cursor. If not wrapping, stick at the last character and
|
* Move the cursor. If not wrapping, stick at the last character and
|
||||||
* replace it.
|
* replace it.
|
||||||
@@ -2467,7 +2482,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
if (s->cx <= sx - not_wrap - width)
|
if (s->cx <= sx - not_wrap - width)
|
||||||
screen_write_set_cursor(ctx, s->cx + width, -1);
|
screen_write_set_cursor(ctx, s->cx + width, -1);
|
||||||
else
|
else
|
||||||
screen_write_set_cursor(ctx, sx - not_wrap, -1);
|
screen_write_set_cursor(ctx, sx - not_wrap, -1);
|
||||||
|
|
||||||
/* Create space for character in insert mode. */
|
/* Create space for character in insert mode. */
|
||||||
if (s->mode & MODE_INSERT) {
|
if (s->mode & MODE_INSERT) {
|
||||||
@@ -2476,16 +2491,44 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write to the screen. */
|
/* If not writing, done now. */
|
||||||
if (!skip && !(s->mode & MODE_SYNC)) {
|
if (skip || s->mode & MODE_SYNC)
|
||||||
if (selected) {
|
return;
|
||||||
screen_select_cell(s, &tmp_gc, gc);
|
|
||||||
ttyctx.cell = &tmp_gc;
|
/* Do a full line redraw if needed. */
|
||||||
} else
|
if (redraw) {
|
||||||
ttyctx.cell = gc;
|
screen_write_redraw_line(ctx, &ttyctx, s->cy);
|
||||||
if (redraw)
|
return;
|
||||||
ttyctx.flags |= TTY_CTX_CELL_DRAW_LINE;
|
}
|
||||||
|
|
||||||
|
/* Work out the cell attributes. */
|
||||||
|
if (selected)
|
||||||
|
screen_select_cell(s, &tmp_gc, gc);
|
||||||
|
else
|
||||||
|
memcpy(&tmp_gc, gc, sizeof tmp_gc);
|
||||||
|
ttyctx.cell = &tmp_gc;
|
||||||
|
|
||||||
|
/* If the cell is fully visible, it can be written entirely. */
|
||||||
|
for (i = 0, vis = 0; i < r->used; i++)
|
||||||
|
vis += r->ranges[i].nx;
|
||||||
|
if (vis >= width) {
|
||||||
tty_write(tty_cmd_cell, &ttyctx);
|
tty_write(tty_cmd_cell, &ttyctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Otherwise this is a wide character or tab partly obscured. Write
|
||||||
|
* spaces in the visible regions.
|
||||||
|
*/
|
||||||
|
utf8_set(&tmp_gc.data, ' ');
|
||||||
|
for (i = 0; i < r->used; i++) {
|
||||||
|
ri = &r->ranges[i];
|
||||||
|
if (ri->nx == 0)
|
||||||
|
continue;
|
||||||
|
for (n = 0; n < ri->nx; n++) {
|
||||||
|
ttyctx.ocx = ri->px + n;
|
||||||
|
tty_write(tty_cmd_cell, &ttyctx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2494,12 +2537,15 @@ static int
|
|||||||
screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
|
struct window_pane *wp = ctx->wp;
|
||||||
struct grid *gd = s->grid;
|
struct grid *gd = s->grid;
|
||||||
const struct utf8_data *ud = &gc->data;
|
const struct utf8_data *ud = &gc->data;
|
||||||
u_int n, cx = s->cx, cy = s->cy;
|
struct options *oo = global_options;
|
||||||
|
u_int i, n, cx = s->cx, cy = s->cy, vis, yoff = 0;
|
||||||
struct grid_cell last;
|
struct grid_cell last;
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
int force_wide = 0, zero_width = 0;
|
int force_wide = 0, zero_width = 0;
|
||||||
|
struct visible_ranges *r;
|
||||||
|
|
||||||
/* Ignore U+3164 HANGUL_FILLER entirely. */
|
/* Ignore U+3164 HANGUL_FILLER entirely. */
|
||||||
if (utf8_is_hangul_filler(ud))
|
if (utf8_is_hangul_filler(ud))
|
||||||
@@ -2514,7 +2560,7 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
zero_width = 1;
|
zero_width = 1;
|
||||||
else if (utf8_is_vs(ud)) {
|
else if (utf8_is_vs(ud)) {
|
||||||
zero_width = 1;
|
zero_width = 1;
|
||||||
if (options_get_number(global_options, "variation-selector-always-wide"))
|
if (options_get_number(oo, "variation-selector-always-wide"))
|
||||||
force_wide = 1;
|
force_wide = 1;
|
||||||
} else if (ud->width == 0)
|
} else if (ud->width == 0)
|
||||||
zero_width = 1;
|
zero_width = 1;
|
||||||
@@ -2587,6 +2633,24 @@ screen_write_combine(struct screen_write_ctx *ctx, const struct grid_cell *gc)
|
|||||||
if (force_wide)
|
if (force_wide)
|
||||||
grid_view_set_padding(gd, cx - 1, cy);
|
grid_view_set_padding(gd, cx - 1, cy);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if all of this character is visible. No character will be
|
||||||
|
* obscured in the middle, only on left or right, but there could be an
|
||||||
|
* empty range in the visible ranges so we add them all up.
|
||||||
|
*/
|
||||||
|
if (wp != NULL)
|
||||||
|
yoff = wp->yoff;
|
||||||
|
r = screen_redraw_get_visible_ranges(wp, cx - n, cy + yoff, n, NULL);
|
||||||
|
for (i = 0, vis = 0; i < r->used; i++)
|
||||||
|
vis += r->ranges[i].nx;
|
||||||
|
if (vis < n) {
|
||||||
|
/*
|
||||||
|
* Part of this character is obscured. Return 1 and let
|
||||||
|
* screen_write_cell write a space.
|
||||||
|
*/
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Redraw the combined cell. If forcing the cell to width 2, reset the
|
* Redraw the combined cell. If forcing the cell to width 2, reset the
|
||||||
* cached cursor position in the tty, since we don't really know
|
* cached cursor position in the tty, since we don't really know
|
||||||
|
|||||||
9
tty.c
9
tty.c
@@ -2024,14 +2024,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
(gcp->data.width == 1 && !tty_check_overlay(tty, px, py)))
|
(gcp->data.width == 1 && !tty_check_overlay(tty, px, py)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ctx->flags & TTY_CTX_CELL_DRAW_LINE) {
|
if (gcp->data.width > 1) { /* could be partially obscured */
|
||||||
tty_draw_line(tty, s, 0, s->cy, screen_size_x(s),
|
|
||||||
ctx->xoff - ctx->wox, py, &ctx->defaults, ctx->palette);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Handle partially obstructed wide characters. */
|
|
||||||
if (gcp->data.width > 1) {
|
|
||||||
r = tty_check_overlay_range(tty, px, py, gcp->data.width);
|
r = tty_check_overlay_range(tty, px, py, gcp->data.width);
|
||||||
for (i = 0; i < r->used; i++)
|
for (i = 0; i < r->used; i++)
|
||||||
vis += r->ranges[i].nx;
|
vis += r->ranges[i].nx;
|
||||||
|
|||||||
Reference in New Issue
Block a user