summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/format.c5
-rw-r--r--usr.bin/tmux/tmux.15
-rw-r--r--usr.bin/tmux/tmux.h27
-rw-r--r--usr.bin/tmux/tty-keys.c42
-rw-r--r--usr.bin/tmux/tty-term.c4
-rw-r--r--usr.bin/tmux/tty.c25
6 files changed, 32 insertions, 76 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index 51778d89b8b..07985f12d4a 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.222 2019/12/26 14:48:29 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.223 2020/01/12 21:07:07 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2346,7 +2346,6 @@ format_defaults_client(struct format_tree *ft, struct client *c)
struct session *s;
const char *name;
struct tty *tty = &c->tty;
- const char *types[] = TTY_TYPES;
if (ft->s == NULL)
ft->s = c->session;
@@ -2364,8 +2363,6 @@ format_defaults_client(struct format_tree *ft, struct client *c)
if (tty->term_name != NULL)
format_add(ft, "client_termname", "%s", tty->term_name);
- if (tty->term_name != NULL)
- format_add(ft, "client_termtype", "%s", types[tty->term_type]);
format_add_tv(ft, "client_created", &c->creation_time);
format_add_tv(ft, "client_activity", &c->activity_time);
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index c9cdadea167..ffcdf843046 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.703 2020/01/01 22:12:05 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.704 2020/01/12 21:07:07 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: January 1 2020 $
+.Dd $Mdocdate: January 12 2020 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -4227,7 +4227,6 @@ The following variables are available, where appropriate:
.It Li "client_readonly" Ta "" Ta "1 if client is readonly"
.It Li "client_session" Ta "" Ta "Name of the client's session"
.It Li "client_termname" Ta "" Ta "Terminal name of client"
-.It Li "client_termtype" Ta "" Ta "Terminal type of client"
.It Li "client_tty" Ta "" Ta "Pseudo terminal of client"
.It Li "client_utf8" Ta "" Ta "1 if client supports UTF-8"
.It Li "client_width" Ta "" Ta "Width of client"
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 2c4242dd59e..b735f5df690 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.944 2019/12/30 21:24:55 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.945 2020/01/12 21:07:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1168,7 +1168,9 @@ struct tty_term {
struct tty_code *codes;
#define TERM_256COLOURS 0x1
-#define TERM_EARLYWRAP 0x2
+#define TERM_NOXENL 0x2
+#define TERM_DECSLRM 0x4
+#define TERM_DECFRA 0x8
int flags;
LIST_ENTRY(tty_term) entry;
@@ -1230,16 +1232,6 @@ struct tty {
struct tty_term *term;
char *term_name;
int term_flags;
- enum {
- TTY_VT100,
- TTY_VT101,
- TTY_VT102,
- TTY_VT220,
- TTY_VT320,
- TTY_VT420,
- TTY_VT520,
- TTY_UNKNOWN
- } term_type;
u_int mouse_last_x;
u_int mouse_last_y;
@@ -1253,15 +1245,6 @@ struct tty {
struct event key_timer;
struct tty_key *key_tree;
};
-#define TTY_TYPES \
- { "VT100", \
- "VT101", \
- "VT102", \
- "VT220", \
- "VT320", \
- "VT420", \
- "VT520", \
- "Unknown" }
/* TTY command context. */
struct tty_ctx {
@@ -1992,7 +1975,7 @@ void tty_draw_line(struct tty *, struct window_pane *, struct screen *,
int tty_open(struct tty *, char **);
void tty_close(struct tty *);
void tty_free(struct tty *);
-void tty_set_type(struct tty *, int);
+void tty_set_flags(struct tty *, int);
void tty_write(void (*)(struct tty *, const struct tty_ctx *),
struct tty_ctx *);
void tty_cmd_alignmenttest(struct tty *, const struct tty_ctx *);
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index 18113def59c..aed381eaf5d 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.117 2020/01/12 20:20:20 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.118 2020/01/12 21:07:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1001,11 +1001,10 @@ static int
tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
size_t *size)
{
- struct client *c = tty->client;
- u_int i, n = 0;
- char tmp[64], *endptr, p[32] = { 0 }, *cp, *next;
- static const char *types[] = TTY_TYPES;
- int type;
+ struct client *c = tty->client;
+ u_int i, n = 0;
+ char tmp[64], *endptr, p[32] = { 0 }, *cp, *next;
+ int flags = 0;
*size = 0;
@@ -1043,36 +1042,15 @@ tty_keys_device_attributes(struct tty *tty, const char *buf, size_t len,
n++;
}
- /* Store terminal type. */
- type = TTY_UNKNOWN;
+ /* Set terminal flags. */
switch (p[0]) {
- case 1:
- if (p[1] == 2)
- type = TTY_VT100;
- else if (p[1] == 0)
- type = TTY_VT101;
- break;
- case 6:
- type = TTY_VT102;
- break;
- case 62:
- type = TTY_VT220;
- break;
- case 63:
- type = TTY_VT320;
- break;
- case 64:
- type = TTY_VT420;
- break;
- case 65:
- type = TTY_VT520;
+ case 64: /* VT420 */
+ flags |= (TERM_DECFRA|TERM_DECSLRM);
break;
}
for (i = 1; i < n; i++)
log_debug("%s: DA feature: %d", c->name, p[i]);
- tty_set_type(tty, type);
-
- log_debug("%s: received DA %.*s (%s)", c->name, (int)*size, buf,
- types[type]);
+ log_debug("%s: received DA %.*s", c->name, (int)*size, buf);
+ tty_set_flags(tty, flags);
return (0);
}
diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c
index 3835454505d..7f3edd3ecd0 100644
--- a/usr.bin/tmux/tty-term.c
+++ b/usr.bin/tmux/tty-term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-term.c,v 1.69 2019/11/28 09:56:25 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.70 2020/01/12 21:07:07 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -538,7 +538,7 @@ tty_term_find(char *name, int fd, char **cause)
* do the best possible.
*/
if (!tty_term_flag(term, TTYC_XENL))
- term->flags |= TERM_EARLYWRAP;
+ term->flags |= TERM_NOXENL;
/* Generate ACS table. If none is present, use nearest ASCII. */
memset(term->acs, 0, sizeof term->acs);
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index a626d754459..387627f884b 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.336 2019/12/11 12:13:37 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.337 2020/01/12 21:07:07 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -74,7 +74,7 @@ static void tty_default_attributes(struct tty *, struct window_pane *,
u_int);
#define tty_use_margin(tty) \
- ((tty)->term_type == TTY_VT420)
+ ((tty->term->flags|tty->term_flags) & TERM_DECSLRM)
#define tty_pane_full_width(tty, ctx) \
((ctx)->xoff == 0 && screen_size_x((ctx)->wp->screen) >= (tty)->sx)
@@ -115,9 +115,7 @@ tty_init(struct tty *tty, struct client *c, int fd, char *term)
tty->ccolour = xstrdup("");
tty->flags = 0;
-
tty->term_flags = 0;
- tty->term_type = TTY_UNKNOWN;
return (0);
}
@@ -438,9 +436,9 @@ tty_free(struct tty *tty)
}
void
-tty_set_type(struct tty *tty, int type)
+tty_set_flags(struct tty *tty, int flags)
{
- tty->term_type = type;
+ tty->term_flags |= flags;
if (tty_use_margin(tty))
tty_puts(tty, "\033[?69h"); /* DECLRMM */
@@ -543,7 +541,7 @@ tty_putc(struct tty *tty, u_char ch)
{
const char *acs;
- if ((tty->term->flags & TERM_EARLYWRAP) &&
+ if ((tty->term->flags & TERM_NOXENL) &&
ch >= 0x20 && ch != 0x7f &&
tty->cy == tty->sy - 1 &&
tty->cx + 1 >= tty->sx)
@@ -569,7 +567,7 @@ tty_putc(struct tty *tty, u_char ch)
* where we think it should be after a line wrap - this
* means it works on sensible terminals as well.
*/
- if (tty->term->flags & TERM_EARLYWRAP)
+ if (tty->term->flags & TERM_NOXENL)
tty_putcode2(tty, TTYC_CUP, tty->cy, tty->cx);
} else
tty->cx++;
@@ -579,7 +577,7 @@ tty_putc(struct tty *tty, u_char ch)
void
tty_putn(struct tty *tty, const void *buf, size_t len, u_int width)
{
- if ((tty->term->flags & TERM_EARLYWRAP) &&
+ if ((tty->term->flags & TERM_NOXENL) &&
tty->cy == tty->sy - 1 &&
tty->cx + len >= tty->sx)
len = tty->sx - tty->cx - 1;
@@ -1129,7 +1127,8 @@ tty_clear_area(struct tty *tty, struct window_pane *wp, u_int py, u_int ny,
* background colour isn't default (because it doesn't work
* after SGR 0).
*/
- if (tty->term_type == TTY_VT420 && !COLOUR_DEFAULT(bg)) {
+ if (((tty->term->flags|tty->term_flags) & TERM_DECFRA) &&
+ !COLOUR_DEFAULT(bg)) {
xsnprintf(tmp, sizeof tmp, "\033[32;%u;%u;%u;%u$x",
py + 1, px + 1, py + ny, px + nx);
tty_puts(tty, tmp);
@@ -1824,7 +1823,7 @@ tty_cmd_cells(struct tty *tty, const struct tty_ctx *ctx)
ctx->xoff + ctx->ocx + ctx->num > ctx->ox + ctx->sx)) {
if (!ctx->wrapped ||
!tty_pane_full_width(tty, ctx) ||
- (tty->term->flags & TERM_EARLYWRAP) ||
+ (tty->term->flags & TERM_NOXENL) ||
ctx->xoff + ctx->ocx != 0 ||
ctx->yoff + ctx->ocy != tty->cy + 1 ||
tty->cx < tty->sx ||
@@ -1873,7 +1872,7 @@ tty_cell(struct tty *tty, const struct grid_cell *gc, struct window_pane *wp)
const struct grid_cell *gcp;
/* Skip last character if terminal is stupid. */
- if ((tty->term->flags & TERM_EARLYWRAP) &&
+ if ((tty->term->flags & TERM_NOXENL) &&
tty->cy == tty->sy - 1 &&
tty->cx == tty->sx - 1)
return;
@@ -2032,7 +2031,7 @@ tty_cursor_pane_unless_wrap(struct tty *tty, const struct tty_ctx *ctx,
{
if (!ctx->wrapped ||
!tty_pane_full_width(tty, ctx) ||
- (tty->term->flags & TERM_EARLYWRAP) ||
+ (tty->term->flags & TERM_NOXENL) ||
ctx->xoff + cx != 0 ||
ctx->yoff + cy != tty->cy + 1 ||
tty->cx < tty->sx ||