From 0711c05bb9c4a660c757abb6b37355eb9c27a06d Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 8 Jul 2021 11:14:53 +0000 Subject: [PATCH] Fix mouse_word format now word-separators has no space and position of menu if too close to the bottom. --- usr.bin/tmux/cmd-display-menu.c | 4 ++-- usr.bin/tmux/format.c | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/usr.bin/tmux/cmd-display-menu.c b/usr.bin/tmux/cmd-display-menu.c index aeaffbb45a5..2e984202bb2 100644 --- a/usr.bin/tmux/cmd-display-menu.c +++ b/usr.bin/tmux/cmd-display-menu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-menu.c,v 1.24 2021/06/10 07:22:06 nicm Exp $ */ +/* $OpenBSD: cmd-display-menu.c,v 1.25 2021/07/08 11:14:53 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -176,7 +176,7 @@ cmd_display_menu_get_position(struct client *tc, struct cmdq_item *item, format_add(ft, "popup_mouse_centre_y", "%ld", n); n = (long)event->m.y + h; if (n + h >= tty->sy) - format_add(ft, "popup_mouse_top", "%u", tty->sy - h); + format_add(ft, "popup_mouse_top", "%u", tty->sy - 1); else format_add(ft, "popup_mouse_top", "%ld", n); n = event->m.y - h; diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index a9d6ac9cb77..c701323d01c 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.286 2021/06/10 07:58:08 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.287 2021/07/08 11:14:53 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -4809,7 +4809,8 @@ format_grid_word(struct grid *gd, u_int x, u_int y) grid_get_cell(gd, x, y, &gc); if (gc.flags & GRID_FLAG_PADDING) break; - if (utf8_cstrhas(ws, &gc.data)) { + if (utf8_cstrhas(ws, &gc.data) || + (gc.data.size == 1 && *gc.data.data == ' ')) { found = 1; break; } @@ -4846,7 +4847,8 @@ format_grid_word(struct grid *gd, u_int x, u_int y) grid_get_cell(gd, x, y, &gc); if (gc.flags & GRID_FLAG_PADDING) break; - if (utf8_cstrhas(ws, &gc.data)) + if (utf8_cstrhas(ws, &gc.data) || + (gc.data.size == 1 && *gc.data.data == ' ')) break; ud = xreallocarray(ud, size + 2, sizeof *ud); -- 2.20.1