本文整理汇总了C++中screen_write_cursormove函数的典型用法代码示例。如果您正苦于以下问题:C++ screen_write_cursormove函数的具体用法?C++ screen_write_cursormove怎么用?C++ screen_write_cursormove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了screen_write_cursormove函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: window_copy_scroll_down
void
window_copy_scroll_down(struct window_pane *wp, u_int ny)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
struct screen_write_ctx ctx;
if (ny > screen_hsize(&wp->base))
return;
if (data->oy > screen_hsize(&wp->base) - ny)
ny = screen_hsize(&wp->base) - data->oy;
if (ny == 0)
return;
data->oy += ny;
screen_write_start(&ctx, wp, NULL);
screen_write_cursormove(&ctx, 0, 0);
screen_write_insertline(&ctx, ny);
window_copy_write_lines(wp, &ctx, 0, ny);
if (s->sel.flag && screen_size_y(s) > ny) {
window_copy_update_selection(wp);
window_copy_write_line(wp, &ctx, ny);
} else if (ny == 1) /* nuke position */
window_copy_write_line(wp, &ctx, 1);
screen_write_cursormove(&ctx, data->cx, data->cy);
window_copy_update_selection(wp);
screen_write_stop(&ctx);
}
示例2: window_copy_scroll_up
void
window_copy_scroll_up(struct window_pane *wp, u_int ny)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
struct screen_write_ctx ctx;
if (data->oy < ny)
ny = data->oy;
if (ny == 0)
return;
data->oy -= ny;
screen_write_start(&ctx, wp, NULL);
screen_write_cursormove(&ctx, 0, 0);
screen_write_deleteline(&ctx, ny);
window_copy_write_lines(wp, &ctx, screen_size_y(s) - ny, ny);
window_copy_write_line(wp, &ctx, 0);
if (screen_size_y(s) > 1)
window_copy_write_line(wp, &ctx, 1);
if (screen_size_y(s) > 3)
window_copy_write_line(wp, &ctx, screen_size_y(s) - 2);
if (s->sel.flag && screen_size_y(s) > ny) {
window_copy_update_selection(wp);
window_copy_write_line(wp, &ctx, screen_size_y(s) - ny - 1);
}
screen_write_cursormove(&ctx, data->cx, data->cy);
window_copy_update_selection(wp);
screen_write_stop(&ctx);
}
示例3: window_copy_write_line
void
window_copy_write_line(
struct window_pane *wp, struct screen_write_ctx *ctx, u_int py)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
struct options *oo = &wp->window->options;
struct grid_cell gc;
char hdr[32];
size_t last, xoff = 0, size = 0;
memcpy(&gc, &grid_default_cell, sizeof gc);
colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
gc.attr |= options_get_number(oo, "mode-attr");
last = screen_size_y(s) - 1;
if (py == 0) {
size = xsnprintf(hdr, sizeof hdr,
"[%u/%u]", data->oy, screen_hsize(data->backing));
if (size > screen_size_x(s))
size = screen_size_x(s);
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
screen_write_puts(ctx, &gc, "%s", hdr);
} else if (py == last && data->inputtype != WINDOW_COPY_OFF) {
if (data->inputtype == WINDOW_COPY_NUMERICPREFIX) {
xoff = size = xsnprintf(hdr, sizeof hdr,
"Repeat: %u", data->numprefix);
} else {
xoff = size = xsnprintf(hdr, sizeof hdr,
"%s: %s", data->inputprompt, data->inputstr);
}
screen_write_cursormove(ctx, 0, last);
screen_write_puts(ctx, &gc, "%s", hdr);
} else
size = 0;
screen_write_cursormove(ctx, xoff, py);
screen_write_copy(ctx, data->backing, xoff,
(screen_hsize(data->backing) - data->oy) + py,
screen_size_x(s) - size, 1);
if (py == data->cy && data->cx == screen_size_x(s)) {
memcpy(&gc, &grid_default_cell, sizeof gc);
screen_write_cursormove(ctx, screen_size_x(s) - 1, py);
screen_write_putc(ctx, &gc, '$');
}
}
示例4: input_csi_dispatch_sm_private
/* Handle CSI private SM. */
void
input_csi_dispatch_sm_private(struct input_ctx *ictx)
{
u_int i;
for (i = 0; i < ictx->param_list_len; i++) {
switch (input_get(ictx, i, 0, -1)) {
case 1: /* DECCKM */
screen_write_mode_set(&ictx->ctx, MODE_KCURSOR);
break;
case 3: /* DECCOLM */
screen_write_cursormove(&ictx->ctx, 0, 0);
screen_write_clearscreen(&ictx->ctx);
break;
case 7: /* DECAWM */
screen_write_mode_set(&ictx->ctx, MODE_WRAP);
break;
case 25: /* TCEM */
screen_write_mode_set(&ictx->ctx, MODE_CURSOR);
break;
case 1000:
screen_write_mode_clear(&ictx->ctx, ALL_MOUSE_MODES);
screen_write_mode_set(&ictx->ctx, MODE_MOUSE_STANDARD);
break;
case 1002:
screen_write_mode_clear(&ictx->ctx, ALL_MOUSE_MODES);
screen_write_mode_set(&ictx->ctx, MODE_MOUSE_BUTTON);
break;
case 1003:
screen_write_mode_clear(&ictx->ctx, ALL_MOUSE_MODES);
screen_write_mode_set(&ictx->ctx, MODE_MOUSE_ANY);
break;
case 1004:
if (ictx->ctx.s->mode & MODE_FOCUSON)
break;
screen_write_mode_set(&ictx->ctx, MODE_FOCUSON);
ictx->wp->flags |= PANE_FOCUSPUSH; /* force update */
break;
case 1005:
screen_write_mode_set(&ictx->ctx, MODE_MOUSE_UTF8);
break;
case 1006:
screen_write_mode_set(&ictx->ctx, MODE_MOUSE_SGR);
break;
case 47:
case 1047:
window_pane_alternate_on(ictx->wp, &ictx->cell, 0);
break;
case 1049:
window_pane_alternate_on(ictx->wp, &ictx->cell, 1);
break;
case 2004:
screen_write_mode_set(&ictx->ctx, MODE_BRACKETPASTE);
break;
default:
log_debug("%s: unknown '%c'", __func__, ictx->ch);
break;
}
}
}
示例5: screen_write_copy
/* Copy from another screen. */
void
screen_write_copy(struct screen_write_ctx *ctx,
struct screen *src, u_int px, u_int py, u_int nx, u_int ny)
{
struct screen *s = ctx->s;
struct grid *gd = src->grid;
struct grid_line *gl;
const struct grid_cell *gc;
const struct grid_utf8 *gu;
struct utf8_data utf8data;
u_int xx, yy, cx, cy, ax, bx;
cx = s->cx;
cy = s->cy;
for (yy = py; yy < py + ny; yy++) {
gl = &gd->linedata[yy];
if (yy < gd->hsize + gd->sy) {
/*
* Find start and end position and copy between
* them. Limit to the real end of the line then use a
* clear EOL only if copying to the end, otherwise
* could overwrite whatever is there already.
*/
if (px > gl->cellsize)
ax = gl->cellsize;
else
ax = px;
if (px + nx == gd->sx && px + nx > gl->cellsize)
bx = gl->cellsize;
else
bx = px + nx;
for (xx = ax; xx < bx; xx++) {
if (xx >= gl->cellsize)
gc = &grid_default_cell;
else
gc = &gl->celldata[xx];
if (!(gc->flags & GRID_FLAG_UTF8)) {
screen_write_cell(ctx, gc, NULL);
continue;
}
/* Reinject the UTF-8 sequence. */
gu = &gl->utf8data[xx];
utf8data.size = grid_utf8_copy(
gu, utf8data.data, sizeof utf8data.data);
utf8data.width = gu->width;
screen_write_cell(ctx, gc, &utf8data);
}
if (px + nx == gd->sx && px + nx > gl->cellsize)
screen_write_clearendofline(ctx);
} else
screen_write_clearline(ctx);
cy++;
screen_write_cursormove(ctx, cx, cy);
}
}
示例6: input_csi_dispatch_rm_private
/* Handle CSI private RM. */
void
input_csi_dispatch_rm_private(struct input_ctx *ictx)
{
struct window_pane *wp = ictx->wp;
u_int i;
for (i = 0; i < ictx->param_list_len; i++) {
switch (input_get(ictx, i, 0, -1)) {
case 1: /* DECCKM */
screen_write_mode_clear(&ictx->ctx, MODE_KCURSOR);
break;
case 3: /* DECCOLM */
screen_write_cursormove(&ictx->ctx, 0, 0);
screen_write_clearscreen(&ictx->ctx);
break;
case 7: /* DECAWM */
screen_write_mode_clear(&ictx->ctx, MODE_WRAP);
break;
case 12:
screen_write_mode_clear(&ictx->ctx, MODE_BLINKING);
break;
case 25: /* TCEM */
screen_write_mode_clear(&ictx->ctx, MODE_CURSOR);
break;
case 1000:
case 1001:
case 1002:
screen_write_mode_clear(&ictx->ctx, ALL_MOUSE_MODES);
break;
case 1004:
screen_write_mode_clear(&ictx->ctx, MODE_FOCUSON);
break;
case 1005:
screen_write_mode_clear(&ictx->ctx, MODE_MOUSE_UTF8);
break;
case 1006:
screen_write_mode_clear(&ictx->ctx, MODE_MOUSE_SGR);
break;
case 47:
case 1047:
window_pane_alternate_off(wp, &ictx->cell.cell, 0);
break;
case 1049:
window_pane_alternate_off(wp, &ictx->cell.cell, 1);
break;
case 2004:
screen_write_mode_clear(&ictx->ctx, MODE_BRACKETPASTE);
break;
default:
log_debug("%s: unknown '%c'", __func__, ictx->ch);
break;
}
}
}
示例7: window_copy_init
struct screen *
window_copy_init(struct window_pane *wp)
{
struct window_copy_mode_data *data;
struct screen *s;
struct screen_write_ctx ctx;
u_int i;
int keys;
wp->modedata = data = xmalloc(sizeof *data);
data->oy = 0;
data->cx = wp->base.cx;
data->cy = wp->base.cy;
data->lastcx = 0;
data->lastsx = 0;
data->rectflag = 0;
data->inputtype = WINDOW_COPY_OFF;
data->inputprompt = NULL;
data->inputstr = xstrdup("");
data->numprefix = 0;
data->searchtype = WINDOW_COPY_OFF;
data->searchstr = NULL;
wp->flags |= PANE_FREEZE;
bufferevent_disable(wp->event, EV_READ|EV_WRITE);
s = &data->screen;
screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
if (options_get_number(&wp->window->options, "mode-mouse"))
s->mode |= MODE_MOUSE;
keys = options_get_number(&wp->window->options, "mode-keys");
if (keys == MODEKEY_EMACS)
mode_key_init(&data->mdata, &mode_key_tree_emacs_copy);
else
mode_key_init(&data->mdata, &mode_key_tree_vi_copy);
s->cx = data->cx;
s->cy = data->cy;
screen_write_start(&ctx, NULL, s);
for (i = 0; i < screen_size_y(s); i++)
window_copy_write_line(wp, &ctx, i);
screen_write_cursormove(&ctx, data->cx, data->cy);
screen_write_stop(&ctx);
return (s);
}
示例8: window_copy_redraw_lines
void
window_copy_redraw_lines(struct window_pane *wp, u_int py, u_int ny)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen_write_ctx ctx;
u_int i;
screen_write_start(&ctx, wp, NULL);
for (i = py; i < py + ny; i++)
window_copy_write_line(wp, &ctx, i);
screen_write_cursormove(&ctx, data->cx, data->cy);
screen_write_stop(&ctx);
}
示例9: screen_write_reset
/* Reset screen state. */
void
screen_write_reset(struct screen_write_ctx *ctx)
{
struct screen *s = ctx->s;
screen_reset_tabs(s);
screen_write_scrollregion(ctx, 0, screen_size_y(s) - 1);
s->mode &= ~(MODE_INSERT|MODE_KCURSOR|MODE_KKEYPAD|MODE_FOCUSON);
s->mode &= ~(ALL_MOUSE_MODES|MODE_MOUSE_UTF8|MODE_MOUSE_SGR);
screen_write_clearscreen(ctx, 8);
screen_write_cursormove(ctx, 0, 0);
}
示例10: window_more_write_line
void
window_more_write_line(
struct window_pane *wp, struct screen_write_ctx *ctx, u_int py)
{
struct window_more_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
struct options *oo = &wp->window->options;
struct grid_cell gc;
char *msg, hdr[32];
size_t size;
int utf8flag;
utf8flag = options_get_number(&wp->window->options, "utf8");
memcpy(&gc, &grid_default_cell, sizeof gc);
if (py == 0) {
size = xsnprintf(hdr, sizeof hdr,
"[%u/%u]", data->top, ARRAY_LENGTH(&data->list));
screen_write_cursormove(ctx, screen_size_x(s) - size, 0);
colour_set_fg(&gc, options_get_number(oo, "mode-fg"));
colour_set_bg(&gc, options_get_number(oo, "mode-bg"));
gc.attr |= options_get_number(oo, "mode-attr");
screen_write_puts(ctx, &gc, "%s", hdr);
memcpy(&gc, &grid_default_cell, sizeof gc);
} else
size = 0;
screen_write_cursormove(ctx, 0, py);
if (data->top + py < ARRAY_LENGTH(&data->list)) {
msg = ARRAY_ITEM(&data->list, data->top + py);
screen_write_nputs(
ctx, screen_size_x(s) - size, &gc, utf8flag, "%s", msg);
}
while (s->cx < screen_size_x(s) - size)
screen_write_putc(ctx, &gc, ' ');
}
示例11: screen_write_reset
/* Reset screen state. */
void
screen_write_reset(struct screen_write_ctx *ctx)
{
screen_reset_tabs(ctx->s);
screen_write_scrollregion(ctx, 0, screen_size_y(ctx->s) - 1);
screen_write_insertmode(ctx, 0);
screen_write_kcursormode(ctx, 0);
screen_write_kkeypadmode(ctx, 0);
screen_write_mousemode_off(ctx);
screen_write_clearscreen(ctx);
screen_write_cursormove(ctx, 0, 0);
}
示例12: screen_write_copy
/* Copy from another screen. */
void
screen_write_copy(struct screen_write_ctx *ctx,
struct screen *src, u_int px, u_int py, u_int nx, u_int ny)
{
struct screen *s = ctx->s;
struct grid *gd = src->grid;
struct grid_line *gl;
const struct grid_cell *gc;
struct utf8_data ud;
u_int xx, yy, cx, cy, ax, bx;
cx = s->cx;
cy = s->cy;
for (yy = py; yy < py + ny; yy++) {
gl = &gd->linedata[yy];
if (yy < gd->hsize + gd->sy) {
/*
* Find start and end position and copy between
* them. Limit to the real end of the line then use a
* clear EOL only if copying to the end, otherwise
* could overwrite whatever is there already.
*/
if (px > gl->cellsize)
ax = gl->cellsize;
else
ax = px;
if (px + nx == gd->sx && px + nx > gl->cellsize)
bx = gl->cellsize;
else
bx = px + nx;
for (xx = ax; xx < bx; xx++) {
if (xx >= gl->cellsize)
gc = &grid_default_cell;
else
gc = &gl->celldata[xx];
grid_cell_get(gc, &ud);
screen_write_cell(ctx, gc);
}
if (px + nx == gd->sx && px + nx > gl->cellsize)
screen_write_clearendofline(ctx);
} else
screen_write_clearline(ctx);
cy++;
screen_write_cursormove(ctx, cx, cy);
}
}
示例13: window_more_scroll_up
void
window_more_scroll_up(struct window_pane *wp)
{
struct window_more_mode_data *data = wp->modedata;
struct screen_write_ctx ctx;
if (data->top == 0)
return;
data->top--;
screen_write_start(&ctx, wp, NULL);
screen_write_cursormove(&ctx, 0, 0);
screen_write_insertline(&ctx, 1);
window_more_write_line(wp, &ctx, 0);
window_more_write_line(wp, &ctx, 1);
screen_write_stop(&ctx);
}
示例14: window_more_scroll_down
void
window_more_scroll_down(struct window_pane *wp)
{
struct window_more_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
struct screen_write_ctx ctx;
if (data->top >= ARRAY_LENGTH(&data->list))
return;
data->top++;
screen_write_start(&ctx, wp, NULL);
screen_write_cursormove(&ctx, 0, 0);
screen_write_deleteline(&ctx, 1);
window_more_write_line(wp, &ctx, screen_size_y(s) - 1);
window_more_write_line(wp, &ctx, 0);
screen_write_stop(&ctx);
}
示例15: screen_write_flush
/* Flush outstanding cell writes. */
static void
screen_write_flush(struct screen_write_ctx *ctx)
{
struct screen *s = ctx->s;
struct tty_ctx ttyctx;
u_int x, y, offset, cx, cy, dirty;
struct grid_cell gc;
if (ctx->dirty == 0)
return;
dirty = 0;
log_debug("%s: dirty %u", __func__, ctx->dirty);
cx = s->cx;
cy = s->cy;
offset = 0;
for (y = 0; y < screen_size_y(s); y++) {
for (x = 0; x < screen_size_x(s); x++) {
offset++;
if (!bit_test(s->dirty, offset - 1))
continue;
bit_clear(s->dirty, offset - 1);
screen_write_cursormove(ctx, x, y);
grid_view_get_cell(s->grid, x, y, &gc);
screen_write_initctx(ctx, &ttyctx);
ttyctx.cell = &gc;
tty_write(tty_cmd_cell, &ttyctx);
ctx->written++;
if (++dirty == ctx->dirty)
break;
}
if (dirty == ctx->dirty)
break;
}
ctx->dirty = 0;
s->cx = cx;
s->cy = cy;
}