diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-05-26 17:34:46 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-05-26 17:34:46 +0000 |
commit | d42f75e5c0133d899df058f961447782d34b158a (patch) | |
tree | 3b2c39dad3e63840d0b3198f9194293f2bce8803 /usr.bin/tmux/grid.c | |
parent | 48405956365d8c4a9a95d0823ee24aaa49eec67f (diff) |
Add formats for word and line under the mouse and use them to add some
items to the pane menu.
Diffstat (limited to 'usr.bin/tmux/grid.c')
-rw-r--r-- | usr.bin/tmux/grid.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c index 451df187b77..6d070c9907e 100644 --- a/usr.bin/tmux/grid.c +++ b/usr.bin/tmux/grid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grid.c,v 1.94 2019/05/13 20:10:23 nicm Exp $ */ +/* $OpenBSD: grid.c,v 1.95 2019/05/26 17:34:45 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1350,3 +1350,22 @@ grid_unwrap_position(struct grid *gd, u_int *px, u_int *py, u_int wx, u_int wy) *px = wx; *py = yy; } + +/* Get length of line. */ +u_int +grid_line_length(struct grid *gd, u_int py) +{ + struct grid_cell gc; + u_int px; + + px = grid_get_line(gd, py)->cellsize; + if (px > gd->sx) + px = gd->sx; + while (px > 0) { + grid_get_cell(gd, px - 1, py, &gc); + if (gc.data.size != 1 || *gc.data.data != ' ') + break; + px--; + } + return (px); +} |