summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-10-25 15:13:11 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-10-25 15:13:11 +0000
commitae9ba25cfc7f852a93c1d98f48a0be5998cd2ee6 (patch)
tree577e6454b85946dffec61df062daf9fd5c00efb0
parentbf92eb7a7424d3103c01f5b5be7d189d6e168b9c (diff)
Do not stop stop at first padding in format_grid_line and handle tabs.
-rw-r--r--usr.bin/tmux/format.c9
-rw-r--r--usr.bin/tmux/window-copy.c11
2 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index a396491840b..f6e8aee6b3d 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.321 2024/10/10 10:41:33 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.322 2024/10/25 15:13:10 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -5273,10 +5273,13 @@ format_grid_line(struct grid *gd, u_int y)
for (x = 0; x < grid_line_length(gd, y); x++) {
grid_get_cell(gd, x, y, &gc);
if (gc.flags & GRID_FLAG_PADDING)
- break;
+ continue;
ud = xreallocarray(ud, size + 2, sizeof *ud);
- memcpy(&ud[size++], &gc.data, sizeof *ud);
+ if (gc.flags & GRID_FLAG_TAB)
+ utf8_set(&ud[size++], '\t');
+ else
+ memcpy(&ud[size++], &gc.data, sizeof *ud);
}
if (size != 0) {
ud[size].size = 0;
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index e9578ea754f..d07dc2aee5d 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.359 2024/10/25 15:00:18 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.360 2024/10/25 15:13:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -4823,12 +4823,9 @@ 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;
- 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
+ if (gc.flags & GRID_FLAG_TAB)
+ utf8_set(&ud, '\t');
+ else
utf8_copy(&ud, &gc.data);
if (ud.size == 1 && (gc.attr & GRID_ATTR_CHARSET)) {
s = tty_acs_get(NULL, ud.data[0]);