From f7fb5df54312fb4d7421ba7b25fa00987085ac65 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 23 Oct 2019 07:42:05 +0000 Subject: Use the existing code in format.c to add foramts for word and line at cursor position in copy mode, from Anindya Mukherjee. --- window-copy.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'window-copy.c') diff --git a/window-copy.c b/window-copy.c index bca236e3..473112e3 100644 --- a/window-copy.c +++ b/window-copy.c @@ -564,6 +564,7 @@ static void window_copy_formats(struct window_mode_entry *wme, struct format_tree *ft) { struct window_copy_mode_data *data = wme->data; + char *s; format_add(ft, "scroll_position", "%d", data->oy); format_add(ft, "rectangle_toggle", "%d", data->rectflag); @@ -578,6 +579,18 @@ window_copy_formats(struct window_mode_entry *wme, struct format_tree *ft) format_add(ft, "selection_end_x", "%d", data->endselx); format_add(ft, "selection_end_y", "%d", data->endsely); } + + s = format_grid_word(data->screen.grid, data->cx, data->cy); + if (s != NULL) { + format_add(ft, "copy_cursor_word", "%s", s); + free(s); + } + + s = format_grid_line(data->screen.grid, data->cy); + if (s != NULL) { + format_add(ft, "copy_cursor_line", "%s", s); + free(s); + } } static void -- cgit