summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/spawn.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2019-11-14 07:55:01 +0000
committernicm <nicm@openbsd.org>2019-11-14 07:55:01 +0000
commitfdd8dc918b0bd5a01daff43667799980fe8d1042 (patch)
treef5be25d05815113d705573ae59213c1505620a8f /usr.bin/tmux/spawn.c
parentavoid a use after free in if_delgroup. (diff)
downloadwireguard-openbsd-fdd8dc918b0bd5a01daff43667799980fe8d1042.tar.xz
wireguard-openbsd-fdd8dc918b0bd5a01daff43667799980fe8d1042.zip
Add an option to set the key sent by backspace for those whose system
uses ^H rather than ^?. GitHub issue 1969.
Diffstat (limited to 'usr.bin/tmux/spawn.c')
-rw-r--r--usr.bin/tmux/spawn.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/tmux/spawn.c b/usr.bin/tmux/spawn.c
index 0b5ec462c53..8b5c3349753 100644
--- a/usr.bin/tmux/spawn.c
+++ b/usr.bin/tmux/spawn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spawn.c,v 1.10 2019/10/07 07:14:07 nicm Exp $ */
+/* $OpenBSD: spawn.c,v 1.11 2019/11/14 07:55:01 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -217,6 +217,7 @@ spawn_pane(struct spawn_context *sc, char **cause)
u_int hlimit;
struct winsize ws;
sigset_t set, oldset;
+ key_code key;
spawn_log(__func__, sc);
@@ -378,13 +379,17 @@ spawn_pane(struct spawn_context *sc, char **cause)
/*
* Update terminal escape characters from the session if available and
- * force VERASE to tmux's \177.
+ * force VERASE to tmux's backspace.
*/
if (tcgetattr(STDIN_FILENO, &now) != 0)
_exit(1);
if (s->tio != NULL)
memcpy(now.c_cc, s->tio->c_cc, sizeof now.c_cc);
- now.c_cc[VERASE] = '\177';
+ key = options_get_number(global_options, "backspace");
+ if (key >= 0x7f)
+ now.c_cc[VERASE] = '\177';
+ else
+ now.c_cc[VERASE] = key;
if (tcsetattr(STDIN_FILENO, TCSANOW, &now) != 0)
_exit(1);