summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2022-03-16 17:00:18 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2022-03-16 17:00:18 +0000
commite56c9e28c319bd905c079725f1475ae2a7f98fcd (patch)
treeae451f63c899a0b6a69ef4c0c6b4f2f7008274aa /usr.bin/tmux/window.c
parentf8c18dd0f846b2dd4e285608bfcceb4e76e20ea4 (diff)
Add an option to set the character used for unused areas of the
terminal, GitHub issue 3110.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r--usr.bin/tmux/window.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c
index e495b0abe38..4aba6e0b3ef 100644
--- a/usr.bin/tmux/window.c
+++ b/usr.bin/tmux/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.278 2022/02/03 07:38:17 nicm Exp $ */
+/* $OpenBSD: window.c,v 1.279 2022/03/16 17:00:17 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -331,6 +331,7 @@ window_create(u_int sx, u_int sy, u_int xpixel, u_int ypixel)
w->id = next_window_id++;
RB_INSERT(windows, &windows, w);
+ window_set_fill_character(w);
window_update_activity(w);
log_debug("%s: @%u create %ux%u (%ux%u)", __func__, w->id, sx, sy,
@@ -362,6 +363,7 @@ window_destroy(struct window *w)
event_del(&w->offset_timer);
options_free(w->options);
+ free(w->fill_character);
free(w->name);
free(w);
@@ -1589,3 +1591,20 @@ window_pane_update_used_data(struct window_pane *wp,
size = EVBUFFER_LENGTH(wp->event->input) - used;
wpo->used += size;
}
+
+void
+window_set_fill_character(struct window *w)
+{
+ const char *value;
+ struct utf8_data *ud;
+
+ free(w->fill_character);
+ w->fill_character = NULL;
+
+ value = options_get_string(w->options, "fill-character");
+ if (*value != '\0' && utf8_isvalid(value)) {
+ ud = utf8_fromcstr(value);
+ if (ud != NULL && ud[0].width == 1)
+ w->fill_character = ud;
+ }
+}