summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/screen-write.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-11-08 08:51:37 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-11-08 08:51:37 +0000
commit80a557e14f0fc4aac1a920de028e43fb4b6259dd (patch)
tree2401027291852bdb46c87ba62edf2ed1d11bcd64 /usr.bin/tmux/screen-write.c
parent5f64f3553ccef70f3e4561f07ea7a0cc75632238 (diff)
Some fixes for searching for tabs, from Alexander Arch.
Diffstat (limited to 'usr.bin/tmux/screen-write.c')
-rw-r--r--usr.bin/tmux/screen-write.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c
index 039cab62dd8..38d118ed9f3 100644
--- a/usr.bin/tmux/screen-write.c
+++ b/usr.bin/tmux/screen-write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: screen-write.c,v 1.229 2024/11/05 09:41:17 nicm Exp $ */
+/* $OpenBSD: screen-write.c,v 1.230 2024/11/08 08:51:36 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -377,7 +377,7 @@ screen_write_strlen(const char *fmt, ...)
if (more == UTF8_DONE)
size += ud.width;
} else {
- if (*ptr > 0x1f && *ptr < 0x7f)
+ if (*ptr == '\t' || (*ptr > 0x1f && *ptr < 0x7f))
size++;
ptr++;
}
@@ -547,7 +547,7 @@ screen_write_vnputs(struct screen_write_ctx *ctx, ssize_t maxlen,
else if (*ptr == '\n') {
screen_write_linefeed(ctx, 0, 8);
screen_write_carriagereturn(ctx);
- } else if (*ptr > 0x1f && *ptr < 0x7f) {
+ } else if (*ptr == '\t' || (*ptr > 0x1f && *ptr < 0x7f)) {
size++;
screen_write_putc(ctx, &gc, *ptr);
}
@@ -2143,7 +2143,17 @@ screen_write_overwrite(struct screen_write_ctx *ctx, struct grid_cell *gc,
break;
log_debug("%s: overwrite at %u,%u", __func__, xx,
s->cy);
- grid_view_set_cell(gd, xx, s->cy, &grid_default_cell);
+ if (gc->flags & GRID_FLAG_TAB) {
+ memcpy(&tmp_gc, gc, sizeof tmp_gc);
+ memset(tmp_gc.data.data, 0,
+ sizeof tmp_gc.data.data);
+ *tmp_gc.data.data = ' ';
+ tmp_gc.data.width = tmp_gc.data.size =
+ tmp_gc.data.have = 1;
+ grid_view_set_cell(gd, xx, s->cy, &tmp_gc);
+ } else
+ grid_view_set_cell(gd, xx, s->cy,
+ &grid_default_cell);
done = 1;
}
}