Use the existing code in format.c to add foramts for word and line at

cursor position in copy mode, from Anindya Mukherjee.
This commit is contained in:
nicm
2019-10-23 07:42:05 +00:00
parent 56e5067c46
commit f7fb5df543
4 changed files with 67 additions and 25 deletions

View File

@ -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