mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Treat tabs as a word separator, from Alexander Arch in GitHub issue
4201.
This commit is contained in:
parent
125a7b9177
commit
62e15e905b
16
format.c
16
format.c
@ -5188,6 +5188,16 @@ format_defaults_paste_buffer(struct format_tree *ft, struct paste_buffer *pb)
|
||||
ft->pb = pb;
|
||||
}
|
||||
|
||||
static int
|
||||
format_is_word_separator(const char *ws, const struct grid_cell *gc)
|
||||
{
|
||||
if (utf8_cstrhas(ws, &gc->data))
|
||||
return (1);
|
||||
if (gc->flags & GRID_FLAG_TAB)
|
||||
return (1);
|
||||
return gc->data.size == 1 && *gc->data.data == ' ';
|
||||
}
|
||||
|
||||
/* Return word at given coordinates. Caller frees. */
|
||||
char *
|
||||
format_grid_word(struct grid *gd, u_int x, u_int y)
|
||||
@ -5207,8 +5217,7 @@ 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) ||
|
||||
(gc.data.size == 1 && *gc.data.data == ' ')) {
|
||||
if (format_is_word_separator(ws, &gc)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
@ -5245,8 +5254,7 @@ 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) ||
|
||||
(gc.data.size == 1 && *gc.data.data == ' '))
|
||||
if (format_is_word_separator(ws, &gc))
|
||||
break;
|
||||
|
||||
ud = xreallocarray(ud, size + 2, sizeof *ud);
|
||||
|
Loading…
Reference in New Issue
Block a user