version 1.234, 2022/05/30 13:07:46 |
version 1.235, 2022/09/09 11:02:23 |
|
|
return (s->statuslines); |
return (s->statuslines); |
} |
} |
|
|
|
/* Get the prompt line number for client's session. 1 means at the bottom. */ |
|
static u_int |
|
status_prompt_line_at(struct client *c) |
|
{ |
|
struct session *s = c->session; |
|
|
|
if (c->flags & (CLIENT_STATUSOFF|CLIENT_CONTROL)) |
|
return (1); |
|
return (options_get_number(s->options, "status-prompt-line")); |
|
} |
|
|
/* Get window at window list position. */ |
/* Get window at window list position. */ |
struct style_range * |
struct style_range * |
status_get_range(struct client *c, u_int x, u_int y) |
status_get_range(struct client *c, u_int x, u_int y) |
|
|
struct session *s = c->session; |
struct session *s = c->session; |
struct screen old_screen; |
struct screen old_screen; |
size_t len; |
size_t len; |
u_int lines, offset; |
u_int lines, offset, messageline; |
struct grid_cell gc; |
struct grid_cell gc; |
struct format_tree *ft; |
struct format_tree *ft; |
|
|
|
|
lines = 1; |
lines = 1; |
screen_init(sl->active, c->tty.sx, lines, 0); |
screen_init(sl->active, c->tty.sx, lines, 0); |
|
|
|
messageline = status_prompt_line_at(c); |
|
if (messageline > lines - 1) |
|
messageline = lines - 1; |
|
|
len = screen_write_strlen("%s", c->message_string); |
len = screen_write_strlen("%s", c->message_string); |
if (len > c->tty.sx) |
if (len > c->tty.sx) |
len = c->tty.sx; |
len = c->tty.sx; |
|
|
format_free(ft); |
format_free(ft); |
|
|
screen_write_start(&ctx, sl->active); |
screen_write_start(&ctx, sl->active); |
screen_write_fast_copy(&ctx, &sl->screen, 0, 0, c->tty.sx, lines - 1); |
screen_write_fast_copy(&ctx, &sl->screen, 0, 0, c->tty.sx, lines); |
screen_write_cursormove(&ctx, 0, lines - 1, 0); |
screen_write_cursormove(&ctx, 0, messageline, 0); |
for (offset = 0; offset < c->tty.sx; offset++) |
for (offset = 0; offset < c->tty.sx; offset++) |
screen_write_putc(&ctx, &gc, ' '); |
screen_write_putc(&ctx, &gc, ' '); |
screen_write_cursormove(&ctx, 0, lines - 1, 0); |
screen_write_cursormove(&ctx, 0, messageline, 0); |
if (c->message_ignore_styles) |
if (c->message_ignore_styles) |
screen_write_nputs(&ctx, len, &gc, "%s", c->message_string); |
screen_write_nputs(&ctx, len, &gc, "%s", c->message_string); |
else |
else |
|
|
struct session *s = c->session; |
struct session *s = c->session; |
struct screen old_screen; |
struct screen old_screen; |
u_int i, lines, offset, left, start, width; |
u_int i, lines, offset, left, start, width; |
u_int pcursor, pwidth; |
u_int pcursor, pwidth, promptline; |
struct grid_cell gc, cursorgc; |
struct grid_cell gc, cursorgc; |
struct format_tree *ft; |
struct format_tree *ft; |
|
|
|
|
lines = 1; |
lines = 1; |
screen_init(sl->active, c->tty.sx, lines, 0); |
screen_init(sl->active, c->tty.sx, lines, 0); |
|
|
|
promptline = status_prompt_line_at(c); |
|
if (promptline > lines - 1) |
|
promptline = lines - 1; |
|
|
ft = format_create_defaults(NULL, c, NULL, NULL, NULL); |
ft = format_create_defaults(NULL, c, NULL, NULL, NULL); |
if (c->prompt_mode == PROMPT_COMMAND) |
if (c->prompt_mode == PROMPT_COMMAND) |
style_apply(&gc, s->options, "message-command-style", ft); |
style_apply(&gc, s->options, "message-command-style", ft); |
|
|
start = c->tty.sx; |
start = c->tty.sx; |
|
|
screen_write_start(&ctx, sl->active); |
screen_write_start(&ctx, sl->active); |
screen_write_fast_copy(&ctx, &sl->screen, 0, 0, c->tty.sx, lines - 1); |
screen_write_fast_copy(&ctx, &sl->screen, 0, 0, c->tty.sx, lines); |
screen_write_cursormove(&ctx, 0, lines - 1, 0); |
screen_write_cursormove(&ctx, 0, promptline, 0); |
for (offset = 0; offset < c->tty.sx; offset++) |
for (offset = 0; offset < c->tty.sx; offset++) |
screen_write_putc(&ctx, &gc, ' '); |
screen_write_putc(&ctx, &gc, ' '); |
screen_write_cursormove(&ctx, 0, lines - 1, 0); |
screen_write_cursormove(&ctx, 0, promptline, 0); |
format_draw(&ctx, &gc, start, c->prompt_string, NULL, 0); |
format_draw(&ctx, &gc, start, c->prompt_string, NULL, 0); |
screen_write_cursormove(&ctx, start, lines - 1, 0); |
screen_write_cursormove(&ctx, start, promptline, 0); |
|
|
left = c->tty.sx - start; |
left = c->tty.sx - start; |
if (left == 0) |
if (left == 0) |