mirror of
https://github.com/tmux/tmux.git
synced 2025-12-21 06:46:08 +00:00
Flag tabs if possible in the grid cell so they can be preserved on
copying and capture-pane. From Alexander Arch in GitHub issue 4201.
This commit is contained in:
@@ -3301,6 +3301,11 @@ window_copy_cellstring(const struct grid_line *gl, u_int px, size_t *size,
|
||||
*allocated = 0;
|
||||
return (&gce->data.data);
|
||||
}
|
||||
if (gce->flags & GRID_FLAG_TAB) {
|
||||
*size = 1;
|
||||
*allocated = 0;
|
||||
return ("\t");
|
||||
}
|
||||
|
||||
utf8_to_data(gl->extddata[gce->offset].data, &ud);
|
||||
if (ud.size == 0) {
|
||||
@@ -4083,9 +4088,15 @@ window_copy_match_at_cursor(struct window_copy_mode_data *data)
|
||||
px = at - (py * sx);
|
||||
|
||||
grid_get_cell(gd, px, gd->hsize + py - data->oy, &gc);
|
||||
buf = xrealloc(buf, len + gc.data.size + 1);
|
||||
memcpy(buf + len, gc.data.data, gc.data.size);
|
||||
len += gc.data.size;
|
||||
if (gc.flags & GRID_FLAG_TAB) {
|
||||
buf = xrealloc(buf, len + 2);
|
||||
buf[len] = '\t';
|
||||
len++;
|
||||
} else {
|
||||
buf = xrealloc(buf, len + gc.data.size + 1);
|
||||
memcpy(buf + len, gc.data.data, gc.data.size);
|
||||
len += gc.data.size;
|
||||
}
|
||||
}
|
||||
if (len != 0)
|
||||
buf[len] = '\0';
|
||||
@@ -4812,7 +4823,13 @@ window_copy_copy_line(struct window_mode_entry *wme, char **buf, size_t *off,
|
||||
grid_get_cell(gd, i, sy, &gc);
|
||||
if (gc.flags & GRID_FLAG_PADDING)
|
||||
continue;
|
||||
utf8_copy(&ud, &gc.data);
|
||||
if (gc.flags & GRID_FLAG_TAB) {
|
||||
memset(ud.data, 0, sizeof ud.data);
|
||||
*ud.data = '\t';
|
||||
ud.have = ud.size = 1;
|
||||
ud.width = gc.data.width;
|
||||
} else
|
||||
utf8_copy(&ud, &gc.data);
|
||||
if (ud.size == 1 && (gc.attr & GRID_ATTR_CHARSET)) {
|
||||
s = tty_acs_get(NULL, ud.data[0]);
|
||||
if (s != NULL && strlen(s) <= sizeof ud.data) {
|
||||
|
||||
Reference in New Issue
Block a user