=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/format.c,v retrieving revision 1.227 retrieving revision 1.228 diff -c -r1.227 -r1.228 *** src/usr.bin/tmux/format.c 2020/03/19 13:43:18 1.227 --- src/usr.bin/tmux/format.c 2020/03/20 17:59:39 1.228 *************** *** 1,4 **** ! /* $OpenBSD: format.c,v 1.227 2020/03/19 13:43:18 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: format.c,v 1.228 2020/03/20 17:59:39 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott *************** *** 948,954 **** ws = options_get_string(global_s_options, "word-separators"); - y = gd->hsize + y; for (;;) { grid_get_cell(gd, x, y, &gc); if (gc.flags & GRID_FLAG_PADDING) --- 948,953 ---- *************** *** 1009,1014 **** --- 1008,1014 ---- format_cb_mouse_word(struct format_tree *ft, struct format_entry *fe) { struct window_pane *wp; + struct grid *gd; u_int x, y; char *s; *************** *** 1017,1028 **** wp = cmd_mouse_pane(&ft->m, NULL, NULL); if (wp == NULL) return; - if (!TAILQ_EMPTY (&wp->modes)) - return; if (cmd_mouse_at(wp, &ft->m, &x, &y, 0) != 0) return; ! s = format_grid_word(wp->base.grid, x, y); if (s != NULL) fe->value = s; } --- 1017,1034 ---- wp = cmd_mouse_pane(&ft->m, NULL, NULL); if (wp == NULL) return; if (cmd_mouse_at(wp, &ft->m, &x, &y, 0) != 0) return; ! if (!TAILQ_EMPTY(&wp->modes)) { ! if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode) ! s = window_copy_get_word(wp, x, y); ! else ! s = NULL; ! } else { ! gd = wp->base.grid; ! s = format_grid_word(gd, x, gd->hsize + y); ! } if (s != NULL) fe->value = s; } *************** *** 1037,1043 **** size_t size = 0; char *s = NULL; - y = gd->hsize + y; for (x = 0; x < grid_line_length(gd, y); x++) { grid_get_cell(gd, x, y, &gc); if (gc.flags & GRID_FLAG_PADDING) --- 1043,1048 ---- *************** *** 1059,1064 **** --- 1064,1070 ---- format_cb_mouse_line(struct format_tree *ft, struct format_entry *fe) { struct window_pane *wp; + struct grid *gd; u_int x, y; char *s; *************** *** 1067,1078 **** wp = cmd_mouse_pane(&ft->m, NULL, NULL); if (wp == NULL) return; - if (!TAILQ_EMPTY (&wp->modes)) - return; if (cmd_mouse_at(wp, &ft->m, &x, &y, 0) != 0) return; ! s = format_grid_line(wp->base.grid, y); if (s != NULL) fe->value = s; } --- 1073,1090 ---- wp = cmd_mouse_pane(&ft->m, NULL, NULL); if (wp == NULL) return; if (cmd_mouse_at(wp, &ft->m, &x, &y, 0) != 0) return; ! if (!TAILQ_EMPTY(&wp->modes)) { ! if (TAILQ_FIRST(&wp->modes)->mode == &window_copy_mode) ! s = window_copy_get_line(wp, y); ! else ! s = NULL; ! } else { ! gd = wp->base.grid; ! s = format_grid_line(gd, gd->hsize + y); ! } if (s != NULL) fe->value = s; }