mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Leave the hardware cursor at the position of the selected line in choose
modes and current editing position and at the command prompt. It is invisible but this is helpful for people using screen readers. GitHub issue 2970.
This commit is contained in:
parent
cb8a0d83fb
commit
b55f0ac6b9
@ -736,10 +736,8 @@ mode_tree_draw(struct mode_tree_data *mtd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sy = screen_size_y(s);
|
sy = screen_size_y(s);
|
||||||
if (!mtd->preview || sy <= 4 || h <= 4 || sy - h <= 4 || w <= 4) {
|
if (!mtd->preview || sy <= 4 || h <= 4 || sy - h <= 4 || w <= 4)
|
||||||
screen_write_stop(&ctx);
|
goto done;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
line = &mtd->line_list[mtd->current];
|
line = &mtd->line_list[mtd->current];
|
||||||
mti = line->item;
|
mti = line->item;
|
||||||
@ -783,6 +781,8 @@ mode_tree_draw(struct mode_tree_data *mtd)
|
|||||||
mtd->drawcb(mtd->modedata, mti->itemdata, &ctx, box_x, box_y);
|
mtd->drawcb(mtd->modedata, mti->itemdata, &ctx, box_x, box_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
screen_write_cursormove(&ctx, 0, mtd->current - mtd->offset, 0);
|
||||||
screen_write_stop(&ctx);
|
screen_write_stop(&ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1706,7 +1706,7 @@ server_client_reset_state(struct client *c)
|
|||||||
struct window_pane *wp = server_client_get_pane(c), *loop;
|
struct window_pane *wp = server_client_get_pane(c), *loop;
|
||||||
struct screen *s = NULL;
|
struct screen *s = NULL;
|
||||||
struct options *oo = c->session->options;
|
struct options *oo = c->session->options;
|
||||||
int mode = 0, cursor, flags;
|
int mode = 0, cursor, flags, n;
|
||||||
u_int cx = 0, cy = 0, ox, oy, sx, sy;
|
u_int cx = 0, cy = 0, ox, oy, sx, sy;
|
||||||
|
|
||||||
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
|
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
|
||||||
@ -1734,7 +1734,20 @@ server_client_reset_state(struct client *c)
|
|||||||
tty_margin_off(tty);
|
tty_margin_off(tty);
|
||||||
|
|
||||||
/* Move cursor to pane cursor and offset. */
|
/* Move cursor to pane cursor and offset. */
|
||||||
if (c->overlay_draw == NULL) {
|
if (c->prompt_string != NULL) {
|
||||||
|
n = options_get_number(c->session->options, "status-position");
|
||||||
|
if (n == 0)
|
||||||
|
cy = 0;
|
||||||
|
else {
|
||||||
|
n = status_line_size(c);
|
||||||
|
if (n == 0)
|
||||||
|
cy = tty->sy - 1;
|
||||||
|
else
|
||||||
|
cy = tty->sy - n;
|
||||||
|
}
|
||||||
|
cx = c->prompt_cursor;
|
||||||
|
mode &= ~MODE_CURSOR;
|
||||||
|
} else if (c->overlay_draw == NULL) {
|
||||||
cursor = 0;
|
cursor = 0;
|
||||||
tty_window_offset(tty, &ox, &oy, &sx, &sy);
|
tty_window_offset(tty, &ox, &oy, &sx, &sy);
|
||||||
if (wp->xoff + s->cx >= ox && wp->xoff + s->cx <= ox + sx &&
|
if (wp->xoff + s->cx >= ox && wp->xoff + s->cx <= ox + sx &&
|
||||||
|
1
status.c
1
status.c
@ -748,6 +748,7 @@ status_prompt_redraw(struct client *c)
|
|||||||
offset = 0;
|
offset = 0;
|
||||||
if (pwidth > left)
|
if (pwidth > left)
|
||||||
pwidth = left;
|
pwidth = left;
|
||||||
|
c->prompt_cursor = start + c->prompt_index - offset;
|
||||||
|
|
||||||
width = 0;
|
width = 0;
|
||||||
for (i = 0; c->prompt_buffer[i].size != 0; i++) {
|
for (i = 0; c->prompt_buffer[i].size != 0; i++) {
|
||||||
|
1
tmux.h
1
tmux.h
@ -1758,6 +1758,7 @@ struct client {
|
|||||||
#define PROMPT_KEY 0x10
|
#define PROMPT_KEY 0x10
|
||||||
int prompt_flags;
|
int prompt_flags;
|
||||||
enum prompt_type prompt_type;
|
enum prompt_type prompt_type;
|
||||||
|
int prompt_cursor;
|
||||||
|
|
||||||
struct session *session;
|
struct session *session;
|
||||||
struct session *last_session;
|
struct session *last_session;
|
||||||
|
Loading…
Reference in New Issue
Block a user