mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Some other tidying bits.
This commit is contained in:
1
input.c
1
input.c
@ -920,7 +920,6 @@ input_parse(struct window_pane *wp)
|
|||||||
/* Split the parameter list (if any). */
|
/* Split the parameter list (if any). */
|
||||||
static int
|
static int
|
||||||
input_split(struct input_ctx *ictx)
|
input_split(struct input_ctx *ictx)
|
||||||
|
|
||||||
{
|
{
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
char *ptr, *out;
|
char *ptr, *out;
|
||||||
|
@ -53,7 +53,6 @@ screen_write_start(struct screen_write_ctx *ctx, struct window_pane *wp,
|
|||||||
{
|
{
|
||||||
u_int size;
|
u_int size;
|
||||||
char tmp[16];
|
char tmp[16];
|
||||||
const char *cp = tmp;
|
|
||||||
|
|
||||||
ctx->wp = wp;
|
ctx->wp = wp;
|
||||||
if (wp != NULL && s == NULL)
|
if (wp != NULL && s == NULL)
|
||||||
@ -71,12 +70,10 @@ screen_write_start(struct screen_write_ctx *ctx, struct window_pane *wp,
|
|||||||
|
|
||||||
ctx->cells = ctx->written = ctx->skipped = 0;
|
ctx->cells = ctx->written = ctx->skipped = 0;
|
||||||
|
|
||||||
if (wp == NULL)
|
if (wp != NULL)
|
||||||
cp = "no pane";
|
|
||||||
else
|
|
||||||
snprintf(tmp, sizeof tmp, "pane %%%u", wp->id);
|
snprintf(tmp, sizeof tmp, "pane %%%u", wp->id);
|
||||||
log_debug("%s: size %ux%u, %s", __func__, screen_size_x(ctx->s),
|
log_debug("%s: size %ux%u, %s", __func__, screen_size_x(ctx->s),
|
||||||
screen_size_y(ctx->s), cp);
|
screen_size_y(ctx->s), wp == NULL ? "no pane" : tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finish writing. */
|
/* Finish writing. */
|
||||||
@ -604,14 +601,16 @@ screen_write_insertcharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
|||||||
if (nx == 0)
|
if (nx == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (s->cx > screen_size_x(s) - 1)
|
||||||
|
return;
|
||||||
|
|
||||||
screen_write_flush(ctx);
|
screen_write_flush(ctx);
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
if (s->cx <= screen_size_x(s) - 1)
|
|
||||||
grid_view_insert_cells(s->grid, s->cx, s->cy, nx, bg);
|
grid_view_insert_cells(s->grid, s->cx, s->cy, nx, bg);
|
||||||
|
|
||||||
ttyctx.num = nx;
|
ttyctx.num = nx;
|
||||||
ttyctx.bg = bg;
|
|
||||||
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
tty_write(tty_cmd_insertcharacter, &ttyctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,14 +629,16 @@ screen_write_deletecharacter(struct screen_write_ctx *ctx, u_int nx, u_int bg)
|
|||||||
if (nx == 0)
|
if (nx == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (s->cx > screen_size_x(s) - 1)
|
||||||
|
return;
|
||||||
|
|
||||||
screen_write_flush(ctx);
|
screen_write_flush(ctx);
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
if (s->cx <= screen_size_x(s) - 1)
|
|
||||||
grid_view_delete_cells(s->grid, s->cx, s->cy, nx, bg);
|
grid_view_delete_cells(s->grid, s->cx, s->cy, nx, bg);
|
||||||
|
|
||||||
ttyctx.num = nx;
|
ttyctx.num = nx;
|
||||||
ttyctx.bg = bg;
|
|
||||||
tty_write(tty_cmd_deletecharacter, &ttyctx);
|
tty_write(tty_cmd_deletecharacter, &ttyctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,13 +657,13 @@ screen_write_clearcharacter(struct screen_write_ctx *ctx, u_int nx)
|
|||||||
if (nx == 0)
|
if (nx == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (s->cx > screen_size_x(s) - 1)
|
||||||
|
return;
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
|
||||||
if (s->cx <= screen_size_x(s) - 1) {
|
|
||||||
screen_dirty_clear(s, s->cx, s->cy, s->cx + nx - 1, s->cy);
|
screen_dirty_clear(s, s->cx, s->cy, s->cx + nx - 1, s->cy);
|
||||||
grid_view_clear(s->grid, s->cx, s->cy, nx, 1, 8);
|
grid_view_clear(s->grid, s->cx, s->cy, nx, 1, 8);
|
||||||
} else
|
|
||||||
return;
|
|
||||||
|
|
||||||
ttyctx.num = nx;
|
ttyctx.num = nx;
|
||||||
tty_write(tty_cmd_clearcharacter, &ttyctx);
|
tty_write(tty_cmd_clearcharacter, &ttyctx);
|
||||||
@ -673,6 +674,7 @@ void
|
|||||||
screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
|
struct grid *gd = s->grid;
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
|
|
||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
@ -686,11 +688,11 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
|||||||
|
|
||||||
screen_write_flush(ctx);
|
screen_write_flush(ctx);
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
grid_view_insert_lines(s->grid, s->cy, ny, bg);
|
grid_view_insert_lines(gd, s->cy, ny, bg);
|
||||||
|
|
||||||
ttyctx.num = ny;
|
ttyctx.num = ny;
|
||||||
ttyctx.bg = bg;
|
|
||||||
tty_write(tty_cmd_insertline, &ttyctx);
|
tty_write(tty_cmd_insertline, &ttyctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -702,16 +704,14 @@ screen_write_insertline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
|||||||
|
|
||||||
screen_write_flush(ctx);
|
screen_write_flush(ctx);
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
if (s->cy < s->rupper || s->cy > s->rlower)
|
if (s->cy < s->rupper || s->cy > s->rlower)
|
||||||
grid_view_insert_lines(s->grid, s->cy, ny, bg);
|
grid_view_insert_lines(gd, s->cy, ny, bg);
|
||||||
else {
|
else
|
||||||
grid_view_insert_lines_region(s->grid, s->rlower, s->cy, ny,
|
grid_view_insert_lines_region(gd, s->rlower, s->cy, ny, bg);
|
||||||
bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
ttyctx.num = ny;
|
ttyctx.num = ny;
|
||||||
ttyctx.bg = bg;
|
|
||||||
tty_write(tty_cmd_insertline, &ttyctx);
|
tty_write(tty_cmd_insertline, &ttyctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,6 +720,7 @@ void
|
|||||||
screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
|
struct grid *gd = s->grid;
|
||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
|
|
||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
@ -733,11 +734,11 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
|||||||
|
|
||||||
screen_write_flush(ctx);
|
screen_write_flush(ctx);
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
grid_view_delete_lines(s->grid, s->cy, ny, bg);
|
grid_view_delete_lines(gd, s->cy, ny, bg);
|
||||||
|
|
||||||
ttyctx.num = ny;
|
ttyctx.num = ny;
|
||||||
ttyctx.bg = bg;
|
|
||||||
tty_write(tty_cmd_deleteline, &ttyctx);
|
tty_write(tty_cmd_deleteline, &ttyctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -749,16 +750,14 @@ screen_write_deleteline(struct screen_write_ctx *ctx, u_int ny, u_int bg)
|
|||||||
|
|
||||||
screen_write_flush(ctx);
|
screen_write_flush(ctx);
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
if (s->cy < s->rupper || s->cy > s->rlower)
|
if (s->cy < s->rupper || s->cy > s->rlower)
|
||||||
grid_view_delete_lines(s->grid, s->cy, ny, bg);
|
grid_view_delete_lines(gd, s->cy, ny, bg);
|
||||||
else {
|
else
|
||||||
grid_view_delete_lines_region(s->grid, s->rlower, s->cy, ny,
|
grid_view_delete_lines_region(gd, s->rlower, s->cy, ny, bg);
|
||||||
bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
ttyctx.num = ny;
|
ttyctx.num = ny;
|
||||||
ttyctx.bg = bg;
|
|
||||||
tty_write(tty_cmd_deleteline, &ttyctx);
|
tty_write(tty_cmd_deleteline, &ttyctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -771,13 +770,13 @@ screen_write_clearline(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
u_int sx = screen_size_x(s);
|
u_int sx = screen_size_x(s);
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
|
||||||
ttyctx.bg = bg;
|
|
||||||
|
|
||||||
gl = &s->grid->linedata[s->grid->hsize + s->cy];
|
gl = &s->grid->linedata[s->grid->hsize + s->cy];
|
||||||
if (gl->cellsize == 0 && bg == 8)
|
if (gl->cellsize == 0 && bg == 8)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
screen_dirty_clear(s, 0, s->cy, sx - 1, s->cy);
|
screen_dirty_clear(s, 0, s->cy, sx - 1, s->cy);
|
||||||
grid_view_clear(s->grid, 0, s->cy, sx, 1, bg);
|
grid_view_clear(s->grid, 0, s->cy, sx, 1, bg);
|
||||||
|
|
||||||
@ -793,13 +792,13 @@ screen_write_clearendofline(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
struct tty_ctx ttyctx;
|
struct tty_ctx ttyctx;
|
||||||
u_int sx = screen_size_x(s);
|
u_int sx = screen_size_x(s);
|
||||||
|
|
||||||
screen_write_initctx(ctx, &ttyctx);
|
|
||||||
ttyctx.bg = bg;
|
|
||||||
|
|
||||||
gl = &s->grid->linedata[s->grid->hsize + s->cy];
|
gl = &s->grid->linedata[s->grid->hsize + s->cy];
|
||||||
if (s->cx > sx - 1 || (s->cx >= gl->cellsize && bg == 8))
|
if (s->cx > sx - 1 || (s->cx >= gl->cellsize && bg == 8))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
screen_write_initctx(ctx, &ttyctx);
|
||||||
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
screen_dirty_clear(s, s->cx, s->cy, sx - 1, s->cy);
|
screen_dirty_clear(s, s->cx, s->cy, sx - 1, s->cy);
|
||||||
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1, bg);
|
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1, bg);
|
||||||
|
|
||||||
@ -925,6 +924,7 @@ void
|
|||||||
screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
|
screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
|
||||||
{
|
{
|
||||||
struct screen *s = ctx->s;
|
struct screen *s = ctx->s;
|
||||||
|
struct grid *gd = s->grid;
|
||||||
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);
|
||||||
|
|
||||||
@ -932,18 +932,16 @@ screen_write_clearendofscreen(struct screen_write_ctx *ctx, u_int bg)
|
|||||||
ttyctx.bg = bg;
|
ttyctx.bg = bg;
|
||||||
|
|
||||||
/* Scroll into history if it is enabled and clearing entire screen. */
|
/* Scroll into history if it is enabled and clearing entire screen. */
|
||||||
if (s->cx == 0 && s->cy == 0 && s->grid->flags & GRID_HISTORY) {
|
if (s->cx == 0 && s->cy == 0 && gd->flags & GRID_HISTORY) {
|
||||||
screen_dirty_clear(s, 0, 0, sx - 1, sy - 1);
|
screen_dirty_clear(s, 0, 0, sx - 1, sy - 1);
|
||||||
grid_view_clear_history(s->grid, bg);
|
grid_view_clear_history(gd, bg);
|
||||||
} else {
|
} else {
|
||||||
if (s->cx <= sx - 1) {
|
if (s->cx <= sx - 1) {
|
||||||
screen_dirty_clear(s, s->cx, s->cy, sx - 1, s->cy);
|
screen_dirty_clear(s, s->cx, s->cy, sx - 1, s->cy);
|
||||||
grid_view_clear(s->grid, s->cx, s->cy, sx - s->cx, 1,
|
grid_view_clear(gd, s->cx, s->cy, sx - s->cx, 1, bg);
|
||||||
bg);
|
|
||||||
}
|
}
|
||||||
screen_dirty_clear(s, 0, s->cy + 1, sx - 1, sy - 1);
|
screen_dirty_clear(s, 0, s->cy + 1, sx - 1, sy - 1);
|
||||||
grid_view_clear(s->grid, 0, s->cy + 1, sx, sy - (s->cy + 1),
|
grid_view_clear(gd, 0, s->cy + 1, sx, sy - (s->cy + 1), bg);
|
||||||
bg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tty_write(tty_cmd_clearendofscreen, &ttyctx);
|
tty_write(tty_cmd_clearendofscreen, &ttyctx);
|
||||||
@ -1277,6 +1275,7 @@ screen_write_overwrite(struct screen_write_ctx *ctx, struct grid_cell *gc,
|
|||||||
return (done);
|
return (done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set external clipboard. */
|
||||||
void
|
void
|
||||||
screen_write_setselection(struct screen_write_ctx *ctx, u_char *str, u_int len)
|
screen_write_setselection(struct screen_write_ctx *ctx, u_char *str, u_int len)
|
||||||
{
|
{
|
||||||
@ -1289,6 +1288,7 @@ screen_write_setselection(struct screen_write_ctx *ctx, u_char *str, u_int len)
|
|||||||
tty_write(tty_cmd_setselection, &ttyctx);
|
tty_write(tty_cmd_setselection, &ttyctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Write unmodified string. */
|
||||||
void
|
void
|
||||||
screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len)
|
screen_write_rawstring(struct screen_write_ctx *ctx, u_char *str, u_int len)
|
||||||
{
|
{
|
||||||
|
@ -963,6 +963,7 @@ server_client_loop(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Resize timer event. */
|
||||||
static void
|
static void
|
||||||
server_client_resize_event(__unused int fd, __unused short events, void *data)
|
server_client_resize_event(__unused int fd, __unused short events, void *data)
|
||||||
{
|
{
|
||||||
|
4
tty.c
4
tty.c
@ -1156,8 +1156,6 @@ tty_cmd_alignmenttest(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
void
|
void
|
||||||
tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct window_pane *wp = ctx->wp;
|
|
||||||
|
|
||||||
if (ctx->xoff + ctx->ocx > tty->sx - 1 && ctx->ocy == ctx->orlower) {
|
if (ctx->xoff + ctx->ocx > tty->sx - 1 && ctx->ocy == ctx->orlower) {
|
||||||
if (tty_pane_full_width(tty, ctx))
|
if (tty_pane_full_width(tty, ctx))
|
||||||
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower);
|
||||||
@ -1167,7 +1165,7 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx)
|
|||||||
|
|
||||||
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
tty_cursor_pane(tty, ctx, ctx->ocx, ctx->ocy);
|
||||||
|
|
||||||
tty_cell(tty, ctx->cell, wp);
|
tty_cell(tty, ctx->cell, ctx->wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user