mirror of
https://github.com/tmate-io/tmate.git
synced 2025-02-08 22:40:02 +01:00
Ensure we overwrite wide characters properly, and never overwrite characters we weren't overlapping.
Fixes "disappearing wide characters" glitch.
This commit is contained in:
parent
e186450788
commit
cac532c3d1
@ -1,4 +1,4 @@
|
|||||||
/* $Id: screen-write.c,v 1.89 2010-04-05 05:11:43 micahcowan Exp $ */
|
/* $Id: screen-write.c,v 1.90 2010-06-16 18:09:23 micahcowan Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
void screen_write_initctx(struct screen_write_ctx *, struct tty_ctx *, int);
|
void screen_write_initctx(struct screen_write_ctx *, struct tty_ctx *, int);
|
||||||
void screen_write_overwrite(struct screen_write_ctx *);
|
void screen_write_overwrite(struct screen_write_ctx *, u_int);
|
||||||
int screen_write_combine(
|
int screen_write_combine(
|
||||||
struct screen_write_ctx *, const struct utf8_data *);
|
struct screen_write_ctx *, const struct utf8_data *);
|
||||||
|
|
||||||
@ -1020,7 +1020,7 @@ screen_write_cell(struct screen_write_ctx *ctx,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Handle overwriting of UTF-8 characters. */
|
/* Handle overwriting of UTF-8 characters. */
|
||||||
screen_write_overwrite(ctx);
|
screen_write_overwrite(ctx, width);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the new character is UTF-8 wide, fill in padding cells. Have
|
* If the new character is UTF-8 wide, fill in padding cells. Have
|
||||||
@ -1123,12 +1123,11 @@ screen_write_combine(
|
|||||||
* by the same character.
|
* by the same character.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
screen_write_overwrite(struct screen_write_ctx *ctx)
|
screen_write_overwrite(struct screen_write_ctx *ctx, u_int width)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
struct grid *gd = s->grid;
|
struct grid *gd = s->grid;
|
||||||
const struct grid_cell *gc;
|
const struct grid_cell *gc;
|
||||||
const struct grid_utf8 *gu;
|
|
||||||
u_int xx;
|
u_int xx;
|
||||||
|
|
||||||
gc = grid_view_peek_cell(gd, s->cx, s->cy);
|
gc = grid_view_peek_cell(gd, s->cx, s->cy);
|
||||||
@ -1148,30 +1147,17 @@ screen_write_overwrite(struct screen_write_ctx *ctx)
|
|||||||
|
|
||||||
/* Overwrite the character at the start of this padding. */
|
/* Overwrite the character at the start of this padding. */
|
||||||
grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
|
grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
|
||||||
|
}
|
||||||
|
|
||||||
/* Overwrite following padding cells. */
|
/*
|
||||||
xx = s->cx;
|
* Overwrite any padding cells that belong to a UTF-8 character
|
||||||
while (++xx < screen_size_x(s)) {
|
* we'll be overwriting with the current character.
|
||||||
gc = grid_view_peek_cell(gd, xx, s->cy);
|
*/
|
||||||
if (!(gc->flags & GRID_FLAG_PADDING))
|
xx = s->cx + width - 1;
|
||||||
break;
|
while (++xx < screen_size_x(s)) {
|
||||||
grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
|
gc = grid_view_peek_cell(gd, xx, s->cy);
|
||||||
}
|
if (!(gc->flags & GRID_FLAG_PADDING))
|
||||||
} else if (gc->flags & GRID_FLAG_UTF8) {
|
break;
|
||||||
gu = grid_view_peek_utf8(gd, s->cx, s->cy);
|
grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
|
||||||
if (gu->width > 1) {
|
|
||||||
/*
|
|
||||||
* An UTF-8 wide cell; overwrite following padding
|
|
||||||
* cells only.
|
|
||||||
*/
|
|
||||||
xx = s->cx;
|
|
||||||
while (++xx < screen_size_x(s)) {
|
|
||||||
gc = grid_view_peek_cell(gd, xx, s->cy);
|
|
||||||
if (!(gc->flags & GRID_FLAG_PADDING))
|
|
||||||
break;
|
|
||||||
grid_view_set_cell(
|
|
||||||
gd, xx, s->cy, &grid_default_cell);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user