mirror of
https://github.com/tmux/tmux.git
synced 2024-11-01 07:08:49 +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;
|
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. */
|
/* Return word at given coordinates. Caller frees. */
|
||||||
char *
|
char *
|
||||||
format_grid_word(struct grid *gd, u_int x, u_int y)
|
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);
|
grid_get_cell(gd, x, y, &gc);
|
||||||
if (gc.flags & GRID_FLAG_PADDING)
|
if (gc.flags & GRID_FLAG_PADDING)
|
||||||
break;
|
break;
|
||||||
if (utf8_cstrhas(ws, &gc.data) ||
|
if (format_is_word_separator(ws, &gc)) {
|
||||||
(gc.data.size == 1 && *gc.data.data == ' ')) {
|
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5245,8 +5254,7 @@ format_grid_word(struct grid *gd, u_int x, u_int y)
|
|||||||
grid_get_cell(gd, x, y, &gc);
|
grid_get_cell(gd, x, y, &gc);
|
||||||
if (gc.flags & GRID_FLAG_PADDING)
|
if (gc.flags & GRID_FLAG_PADDING)
|
||||||
break;
|
break;
|
||||||
if (utf8_cstrhas(ws, &gc.data) ||
|
if (format_is_word_separator(ws, &gc))
|
||||||
(gc.data.size == 1 && *gc.data.data == ' '))
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ud = xreallocarray(ud, size + 2, sizeof *ud);
|
ud = xreallocarray(ud, size + 2, sizeof *ud);
|
||||||
|
Loading…
Reference in New Issue
Block a user