Exemplo n.º 1
0
/* Scroll region down. */
void
grid_view_scroll_region_down(struct grid *gd, u_int rupper, u_int rlower)
{
	rupper = grid_view_y(gd, rupper);
	rlower = grid_view_y(gd, rlower);

	grid_move_lines(gd, rupper + 1, rupper, rlower - rupper);
}
Exemplo n.º 2
0
/* Clear entire history. */
void
screen_write_clearhistory(struct screen_write_ctx *ctx)
{
	struct screen	*s = ctx->s;
	struct grid	*gd = s->grid;

	grid_move_lines(gd, 0, gd->hsize, gd->sy, 8);
	gd->hscrolled = gd->hsize = 0;
}
Exemplo n.º 3
0
/* Scroll region down. */
void
grid_view_scroll_region_down(struct grid *gd, u_int rupper, u_int rlower)
{
	GRID_DEBUG(gd, "rupper=%u, rlower=%u", rupper, rlower);

	rupper = grid_view_y(gd, rupper);
	rlower = grid_view_y(gd, rlower);

	grid_move_lines(gd, rupper + 1, rupper, rlower - rupper);
}
Exemplo n.º 4
0
Arquivo: grid.c Projeto: 20400992/tmux
/* Clear the history. */
void
grid_clear_history(struct grid *gd)
{
	grid_clear_lines(gd, 0, gd->hsize);
	grid_move_lines(gd, 0, gd->hsize, gd->sy);

	gd->hsize = 0;
	gd->linedata = xreallocarray(gd->linedata, gd->sy,
	    sizeof *gd->linedata);
}
Exemplo n.º 5
0
/* Insert lines. */
void
grid_view_insert_lines(struct grid *gd, u_int py, u_int ny)
{
	u_int	sy;

	py = grid_view_y(gd, py);

	sy = grid_view_y(gd, gd->sy);

	grid_move_lines(gd, py + ny, py, sy - py - ny);
}
Exemplo n.º 6
0
/* Delete lines. */
void
grid_view_delete_lines(struct grid *gd, u_int py, u_int ny)
{
	u_int	sy;

	py = grid_view_y(gd, py);

	sy = grid_view_y(gd, gd->sy);

	grid_move_lines(gd, py, py + ny, sy - py - ny);
	grid_clear(gd, 0, sy - ny, gd->sx, py + ny - (sy - ny));
}
Exemplo n.º 7
0
/* Insert lines. */
void
grid_view_insert_lines(struct grid *gd, u_int py, u_int ny)
{
	u_int	sy;

	GRID_DEBUG(gd, "py=%u, ny=%u", py, ny);

	py = grid_view_y(gd, py);

	sy = grid_view_y(gd, gd->sy);

	grid_move_lines(gd, py + ny, py, sy - py - ny);
}
Exemplo n.º 8
0
/* Delete lines inside scroll region. */
void
grid_view_delete_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
{
	u_int	ny2;

	rlower = grid_view_y(gd, rlower);

	py = grid_view_y(gd, py);

	ny2 = rlower + 1 - py - ny;
	grid_move_lines(gd, py, py + ny, ny2);
	grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
}
Exemplo n.º 9
0
/*
 * Collect lines from the history if at the limit. Free the top (oldest) 10%
 * and shift up.
 */
void
grid_collect_history(struct grid *gd)
{
	u_int	yy;

	if (gd->hsize < gd->hlimit)
		return;

	yy = gd->hlimit / 10;
	if (yy < 1)
		yy = 1;

	grid_move_lines(gd, 0, yy, gd->hsize + gd->sy - yy);
	gd->hsize -= yy;
}
Exemplo n.º 10
0
/* Insert lines in region. */
void
grid_view_insert_lines_region(struct grid *gd, u_int rlower, u_int py, u_int ny)
{
	u_int	ny2;

	GRID_DEBUG(gd, "rlower=%u, py=%u, ny=%u", rlower, py, ny);

	rlower = grid_view_y(gd, rlower);

	py = grid_view_y(gd, py);

	ny2 = rlower + 1 - py - ny;
	grid_move_lines(gd, rlower + 1 - ny2, py, ny2);
	grid_clear(gd, 0, py + ny2, gd->sx, ny - ny2);
}
Exemplo n.º 11
0
int
cmd_clear_history_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct args		*args = self->args;
	struct window_pane	*wp;
	struct grid		*gd;

	if (cmd_find_pane(ctx, args_get(args, 't'), NULL, &wp) == NULL)
		return (-1);
	gd = wp->base.grid;

	grid_move_lines(gd, 0, gd->hsize, gd->sy);
	gd->hsize = 0;

	return (0);
}
Exemplo n.º 12
0
enum cmd_retval
cmd_clear_history_exec(struct cmd *self, struct cmd_q *cmdq)
{
	struct args		*args = self->args;
	struct window_pane	*wp;
	struct grid		*gd;

	if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL)
		return (CMD_RETURN_ERROR);
	gd = wp->base.grid;

	grid_move_lines(gd, 0, gd->hsize, gd->sy);
	gd->hsize = 0;

	return (CMD_RETURN_NORMAL);
}
Exemplo n.º 13
0
int
cmd_clear_history_exec(struct cmd *self, struct cmd_ctx *ctx)
{
	struct cmd_target_data	*data = self->data;
	struct window_pane	*wp;
	struct grid		*gd;

	if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
		return (-1);
	gd = wp->base.grid;

	grid_move_lines(gd, 0, gd->hsize, gd->sy);
	gd->hsize = 0;

	return (0);
}
Exemplo n.º 14
0
/* Scroll region up. */
void
grid_view_scroll_region_up(struct grid *gd, u_int rupper, u_int rlower)
{
	if (gd->flags & GRID_HISTORY) {
		grid_collect_history(gd);
		if (rupper == 0 && rlower == gd->sy - 1)
			grid_scroll_history(gd);
		else {
			rupper = grid_view_y(gd, rupper);
			rlower = grid_view_y(gd, rlower);
			grid_scroll_history_region(gd, rupper, rlower);
		}
	} else {
		rupper = grid_view_y(gd, rupper);
		rlower = grid_view_y(gd, rlower);
		grid_move_lines(gd, rupper, rupper + 1, rlower - rupper);
	}
}