mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 18:38:48 +00:00
Disable UTF-8 by default and add options to enable it.
This commit is contained in:
parent
46f5e42145
commit
5ca710d9e3
12
CHANGES
12
CHANGES
@ -1,5 +1,15 @@
|
||||
16 November 2008
|
||||
|
||||
* New window option: "utf8"; this must be on (it is off by default) for UTF-8
|
||||
to be parsed. The global/session option "utf8-default" controls the setting
|
||||
for new windows.
|
||||
|
||||
This means that by default tmux does not handle UTF-8. To use UTF-8 by
|
||||
default it is necessary to a) "set utf8-default on" in .tmux.conf b) start
|
||||
tmux with -u on any terminal which support UTF-8.
|
||||
|
||||
It seems a bit unnecessary for this to be a per-window option but that is
|
||||
the easiest way to do it, and it can't do any harm...
|
||||
* Enable default colours if op contains \033[39;49m, based on a report from
|
||||
fulvio ciriaco.
|
||||
|
||||
@ -697,4 +707,4 @@
|
||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||
customisation.
|
||||
|
||||
$Id: CHANGES,v 1.166 2008-11-16 10:10:26 nicm Exp $
|
||||
$Id: CHANGES,v 1.167 2008-11-16 13:28:59 nicm Exp $
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-set-option.c,v 1.43 2008-09-26 06:45:25 nicm Exp $ */
|
||||
/* $Id: cmd-set-option.c,v 1.44 2008-11-16 13:28:59 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -77,6 +77,7 @@ const struct set_option_entry set_option_table[NSETOPTION] = {
|
||||
{ "status-interval", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
|
||||
{ "status-left", SET_OPTION_STRING, 0, 0, NULL },
|
||||
{ "status-right", SET_OPTION_STRING, 0, 0, NULL },
|
||||
{ "utf8", SET_OPTION_FLAG, 0, 0, NULL },
|
||||
};
|
||||
|
||||
void set_option_string(struct cmd_ctx *,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-set-window-option.c,v 1.12 2008-09-25 23:28:15 nicm Exp $ */
|
||||
/* $Id: cmd-set-window-option.c,v 1.13 2008-11-16 13:28:59 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -181,6 +181,30 @@ cmd_set_window_option_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
s->name, wl->idx, data->option);
|
||||
}
|
||||
|
||||
recalculate_sizes();
|
||||
} else if (strcmp(data->option, "utf8") == 0) {
|
||||
if (flag == -1) {
|
||||
ctx->error(ctx, "bad value: %s", data->value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (flag == -2)
|
||||
wl->window->flags ^= WINDOW_UTF8;
|
||||
else {
|
||||
if (flag)
|
||||
wl->window->flags |= WINDOW_UTF8;
|
||||
else
|
||||
wl->window->flags &= ~WINDOW_UTF8;
|
||||
}
|
||||
|
||||
if (wl->window->flags & WINDOW_UTF8) {
|
||||
ctx->info(ctx, "window %s:%d: set %s",
|
||||
s->name, wl->idx, data->option);
|
||||
} else {
|
||||
ctx->info(ctx, "window %s:%d: cleared %s",
|
||||
s->name, wl->idx, data->option);
|
||||
}
|
||||
|
||||
recalculate_sizes();
|
||||
} else if (strcmp(data->option, "force-width") == 0) {
|
||||
if (data->value == NULL || number == -1) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-show-window-options.c,v 1.2 2008-06-29 07:04:30 nicm Exp $ */
|
||||
/* $Id: cmd-show-window-options.c,v 1.3 2008-11-16 13:28:59 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -62,6 +62,8 @@ cmd_show_window_options_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
ctx->print(ctx, "monitor-activity");
|
||||
if (wl->window->flags & WINDOW_ZOMBIFY)
|
||||
ctx->print(ctx, "remain-on-exit");
|
||||
if (wl->window->flags & WINDOW_UTF8)
|
||||
ctx->print(ctx, "utf8");
|
||||
|
||||
if (ctx->cmdclient != NULL)
|
||||
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
|
||||
|
4
input.c
4
input.c
@ -1,4 +1,4 @@
|
||||
/* $Id: input.c,v 1.66 2008-11-04 20:41:10 nicm Exp $ */
|
||||
/* $Id: input.c,v 1.67 2008-11-16 13:28:59 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -510,7 +510,7 @@ input_state_utf8(u_char ch, struct input_ctx *ictx)
|
||||
void
|
||||
input_handle_character(u_char ch, struct input_ctx *ictx)
|
||||
{
|
||||
if (ch > 0x7f) {
|
||||
if (ictx->w->flags & WINDOW_UTF8 && ch > 0x7f) {
|
||||
/*
|
||||
* UTF-8 sequence.
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: session.c,v 1.45 2008-11-16 10:10:26 nicm Exp $ */
|
||||
/* $Id: session.c,v 1.46 2008-11-16 13:28:59 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -209,6 +209,8 @@ session_new(struct session *s, const char *name, const char *cmd, int idx)
|
||||
|
||||
if (options_get_number(&s->options, "remain-by-default"))
|
||||
w->flags |= WINDOW_ZOMBIFY;
|
||||
if (options_get_number(&s->options, "utf8-default"))
|
||||
w->flags |= WINDOW_UTF8;
|
||||
|
||||
return (session_attach(s, w, idx));
|
||||
}
|
||||
|
16
tmux.1
16
tmux.1
@ -1,4 +1,4 @@
|
||||
.\" $Id: tmux.1,v 1.49 2008-09-25 20:08:56 nicm Exp $
|
||||
.\" $Id: tmux.1,v 1.50 2008-11-16 13:28:59 nicm Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
.\"
|
||||
@ -23,7 +23,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm tmux
|
||||
.Bk -words
|
||||
.Op Fl qVv
|
||||
.Op Fl 2dquVv
|
||||
.Op Fl f Ar file
|
||||
.Op Fl S Ar socket-path
|
||||
.Op Ar command Op Ar flags
|
||||
@ -50,6 +50,14 @@ Communication takes place through a socket, by default placed in
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width "XXXXXXXXXXXX"
|
||||
.It Fl 2
|
||||
Force
|
||||
.Nm
|
||||
to assume the terminal supports 256 colours.
|
||||
.It Fl d
|
||||
Force
|
||||
.Nm
|
||||
to assume the terminal support default colours.
|
||||
.It Fl f Ar file
|
||||
Specify an alternative configuration file.
|
||||
By default,
|
||||
@ -70,6 +78,10 @@ where
|
||||
.Em UID
|
||||
is the uid of the user who invoked
|
||||
.Nm .
|
||||
.If Fl u
|
||||
Intruct
|
||||
.Nm
|
||||
that the terminal support UTF-8.
|
||||
.It Fl V
|
||||
Print program version.
|
||||
.It Fl v
|
||||
|
3
tmux.c
3
tmux.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.c,v 1.79 2008-09-29 16:03:27 nicm Exp $ */
|
||||
/* $Id: tmux.c,v 1.80 2008-11-16 13:28:59 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -231,6 +231,7 @@ main(int argc, char **argv)
|
||||
options_set_number(&global_options, "buffer-limit", 9);
|
||||
options_set_number(&global_options, "remain-by-default", 0);
|
||||
options_set_number(&global_options, "mode-keys", MODEKEY_EMACS);
|
||||
options_set_number(&global_options, "utf8-default", 0);
|
||||
|
||||
if (cfg_file == NULL) {
|
||||
home = getenv("HOME");
|
||||
|
3
tmux.h
3
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.196 2008-11-16 10:10:26 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.197 2008-11-16 13:28:59 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -569,6 +569,7 @@ struct window {
|
||||
#define WINDOW_MONITOR 0x8
|
||||
#define WINDOW_AGGRESSIVE 0x10
|
||||
#define WINDOW_ZOMBIFY 0x20
|
||||
#define WINDOW_UTF8 0x40
|
||||
|
||||
u_int limitx;
|
||||
u_int limity;
|
||||
|
4
tty.c
4
tty.c
@ -1,4 +1,4 @@
|
||||
/* $Id: tty.c,v 1.50 2008-11-16 10:10:26 nicm Exp $ */
|
||||
/* $Id: tty.c,v 1.51 2008-11-16 13:28:59 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -888,7 +888,7 @@ tty_cmd_cell(struct tty *tty, unused struct screen *s, va_list ap)
|
||||
tty_attributes(tty, gc);
|
||||
|
||||
/* If not UTF8 multibyte, write directly. */
|
||||
if (gc->data < 0xff) {
|
||||
if (gc->data <= 0xff) {
|
||||
tty_putc(tty, gc->data);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user