mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Set mouse_x and mouse_y on the status line, GitHub issue 2913.
This commit is contained in:
parent
9f6164a05c
commit
e06a4e041c
28
format.c
28
format.c
@ -1614,11 +1614,16 @@ format_cb_mouse_x(struct format_tree *ft)
|
|||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
u_int x, y;
|
u_int x, y;
|
||||||
|
|
||||||
if (ft->m.valid) {
|
if (!ft->m.valid)
|
||||||
wp = cmd_mouse_pane(&ft->m, NULL, NULL);
|
|
||||||
if (wp != NULL && cmd_mouse_at(wp, &ft->m, &x, &y, 0) == 0)
|
|
||||||
return (format_printf("%u", x));
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
wp = cmd_mouse_pane(&ft->m, NULL, NULL);
|
||||||
|
if (wp != NULL && cmd_mouse_at(wp, &ft->m, &x, &y, 0) == 0)
|
||||||
|
return (format_printf("%u", x));
|
||||||
|
if (ft->c != NULL && (ft->c->tty.flags & TTY_STARTED)) {
|
||||||
|
if (ft->m.statusat == 0 && ft->m.y < ft->m.statuslines)
|
||||||
|
return (format_printf("%u", ft->m.x));
|
||||||
|
if (ft->m.statusat > 0 && ft->m.y >= ft->m.statusat)
|
||||||
|
return (format_printf("%u", ft->m.x));
|
||||||
}
|
}
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@ -1628,13 +1633,18 @@ static void *
|
|||||||
format_cb_mouse_y(struct format_tree *ft)
|
format_cb_mouse_y(struct format_tree *ft)
|
||||||
{
|
{
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
u_int x, y;
|
u_int x, y, top;
|
||||||
|
|
||||||
if (ft->m.valid) {
|
if (!ft->m.valid)
|
||||||
wp = cmd_mouse_pane(&ft->m, NULL, NULL);
|
|
||||||
if (wp != NULL && cmd_mouse_at(wp, &ft->m, &x, &y, 0) == 0)
|
|
||||||
return (format_printf("%u", y));
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
wp = cmd_mouse_pane(&ft->m, NULL, NULL);
|
||||||
|
if (wp != NULL && cmd_mouse_at(wp, &ft->m, &x, &y, 0) == 0)
|
||||||
|
return (format_printf("%u", y));
|
||||||
|
if (ft->c != NULL && (ft->c->tty.flags & TTY_STARTED)) {
|
||||||
|
if (ft->m.statusat == 0 && ft->m.y < ft->m.statuslines)
|
||||||
|
return (format_printf("%u", ft->m.y));
|
||||||
|
if (ft->m.statusat > 0 && ft->m.y >= ft->m.statusat)
|
||||||
|
return (format_printf("%u", ft->m.y - ft->m.statusat));
|
||||||
}
|
}
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user