mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
This commit is contained in:
commit
9e537c808b
15
clock.c
15
clock.c
@ -103,13 +103,20 @@ clock_draw(struct screen_write_ctx *ctx, int colour, int style)
|
|||||||
struct grid_cell gc;
|
struct grid_cell gc;
|
||||||
char tim[64], *ptr;
|
char tim[64], *ptr;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
struct tm *tm;
|
||||||
u_int i, j, x, y, idx;
|
u_int i, j, x, y, idx;
|
||||||
|
|
||||||
t = time(NULL);
|
t = time(NULL);
|
||||||
if (style == 0)
|
tm = localtime(&t);
|
||||||
strftime(tim, sizeof tim, "%l:%M %p", localtime(&t));
|
if (style == 0) {
|
||||||
else
|
strftime(tim, sizeof tim, "%l:%M ", localtime(&t));
|
||||||
strftime(tim, sizeof tim, "%H:%M", localtime(&t));
|
if (tm->tm_hour >= 12)
|
||||||
|
strlcat(tim, "PM", sizeof tim);
|
||||||
|
else
|
||||||
|
strlcat(tim, "AM", sizeof tim);
|
||||||
|
} else
|
||||||
|
strftime(tim, sizeof tim, "%H:%M", tm);
|
||||||
|
|
||||||
|
|
||||||
screen_write_clearscreen(ctx);
|
screen_write_clearscreen(ctx);
|
||||||
|
|
||||||
|
@ -54,9 +54,11 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL)
|
if (cmd_find_pane(cmdq, args_get(args, 't'), NULL, &wp) == NULL)
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
|
|
||||||
if (window_pane_set_mode(wp, &window_copy_mode) != 0)
|
if (wp->mode != &window_copy_mode) {
|
||||||
return (CMD_RETURN_NORMAL);
|
if (window_pane_set_mode(wp, &window_copy_mode) != 0)
|
||||||
window_copy_init_from_pane(wp);
|
return (CMD_RETURN_NORMAL);
|
||||||
|
window_copy_init_from_pane(wp);
|
||||||
|
}
|
||||||
if (wp->mode == &window_copy_mode && args_has(self->args, 'u'))
|
if (wp->mode == &window_copy_mode && args_has(self->args, 'u'))
|
||||||
window_copy_pageup(wp);
|
window_copy_pageup(wp);
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ cmdq_guard(struct cmd_q *cmdq, const char *guard)
|
|||||||
{
|
{
|
||||||
struct client *c = cmdq->client;
|
struct client *c = cmdq->client;
|
||||||
|
|
||||||
if (c == NULL || c->session == NULL)
|
if (c == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
if (!(c->flags & CLIENT_CONTROL))
|
if (!(c->flags & CLIENT_CONTROL))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -49,6 +49,7 @@ cmd_source_file_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
char *cause;
|
char *cause;
|
||||||
|
|
||||||
cmdq1 = cmdq_new(NULL);
|
cmdq1 = cmdq_new(NULL);
|
||||||
|
cmdq1->client = cmdq->client;
|
||||||
cmdq1->emptyfn = cmd_source_file_done;
|
cmdq1->emptyfn = cmd_source_file_done;
|
||||||
cmdq1->data = cmdq;
|
cmdq1->data = cmdq;
|
||||||
|
|
||||||
|
@ -75,8 +75,12 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
src_wp = TAILQ_PREV(dst_wp, window_panes, entry);
|
src_wp = TAILQ_PREV(dst_wp, window_panes, entry);
|
||||||
if (src_wp == NULL)
|
if (src_wp == NULL)
|
||||||
src_wp = TAILQ_LAST(&dst_w->panes, window_panes);
|
src_wp = TAILQ_LAST(&dst_w->panes, window_panes);
|
||||||
} else
|
} else {
|
||||||
return (CMD_RETURN_NORMAL);
|
src_wl = cmd_find_pane(cmdq, NULL, NULL, &src_wp);
|
||||||
|
if (src_wl == NULL)
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
src_w = src_wl->window;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
src_wl = cmd_find_pane(cmdq, args_get(args, 's'), NULL, &src_wp);
|
src_wl = cmd_find_pane(cmdq, args_get(args, 's'), NULL, &src_wp);
|
||||||
if (src_wl == NULL)
|
if (src_wl == NULL)
|
||||||
|
26
colour.c
26
colour.c
@ -287,29 +287,3 @@ colour_256to16(u_char c)
|
|||||||
|
|
||||||
return (table[c]);
|
return (table[c]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert 256 colour palette to 88. */
|
|
||||||
u_char
|
|
||||||
colour_256to88(u_char c)
|
|
||||||
{
|
|
||||||
static const u_char table[256] = {
|
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
|
||||||
16, 17, 17, 18, 18, 19, 20, 21, 21, 22, 22, 23, 20, 21, 21, 22,
|
|
||||||
22, 23, 24, 25, 25, 26, 26, 27, 24, 25, 25, 26, 26, 27, 28, 29,
|
|
||||||
29, 30, 30, 31, 32, 33, 33, 34, 34, 35, 36, 37, 37, 38, 38, 39,
|
|
||||||
36, 37, 37, 38, 38, 39, 40, 41, 41, 42, 42, 43, 40, 41, 41, 42,
|
|
||||||
42, 43, 44, 45, 45, 46, 46, 47, 32, 33, 33, 34, 34, 35, 36, 37,
|
|
||||||
37, 38, 38, 39, 36, 37, 37, 38, 38, 39, 40, 41, 41, 42, 42, 43,
|
|
||||||
40, 41, 41, 42, 42, 43, 44, 45, 45, 46, 46, 47, 48, 49, 49, 50,
|
|
||||||
50, 51, 52, 53, 53, 54, 54, 55, 52, 53, 53, 54, 54, 55, 56, 57,
|
|
||||||
57, 58, 58, 59, 56, 57, 57, 58, 58, 59, 60, 61, 61, 62, 62, 63,
|
|
||||||
48, 49, 49, 50, 50, 51, 52, 53, 53, 54, 54, 55, 52, 53, 53, 54,
|
|
||||||
54, 55, 56, 57, 57, 58, 58, 59, 56, 57, 57, 58, 58, 59, 60, 61,
|
|
||||||
61, 62, 62, 63, 64, 65, 65, 66, 66, 67, 68, 69, 69, 70, 70, 71,
|
|
||||||
68, 69, 69, 70, 70, 71, 72, 73, 73, 74, 74, 75, 72, 73, 73, 74,
|
|
||||||
74, 75, 76, 77, 77, 78, 78, 79, 0, 0, 80, 80, 80, 81, 81, 81,
|
|
||||||
82, 82, 82, 83, 83, 83, 84, 84, 84, 85, 85, 85, 86, 86, 86, 87
|
|
||||||
};
|
|
||||||
|
|
||||||
return (table[c]);
|
|
||||||
}
|
|
||||||
|
2
job.c
2
job.c
@ -108,7 +108,7 @@ job_run(const char *cmd, struct session *s,
|
|||||||
|
|
||||||
job->event = bufferevent_new(job->fd, NULL, job_write_callback,
|
job->event = bufferevent_new(job->fd, NULL, job_write_callback,
|
||||||
job_callback, job);
|
job_callback, job);
|
||||||
bufferevent_enable(job->event, EV_READ);
|
bufferevent_enable(job->event, EV_READ|EV_WRITE);
|
||||||
|
|
||||||
log_debug("run job %p: %s, pid %ld", job, job->cmd, (long) job->pid);
|
log_debug("run job %p: %s, pid %ld", job, job->cmd, (long) job->pid);
|
||||||
return (job);
|
return (job);
|
||||||
|
@ -413,7 +413,7 @@ const struct options_table_entry session_options_table[] = {
|
|||||||
|
|
||||||
{ .name = "terminal-overrides",
|
{ .name = "terminal-overrides",
|
||||||
.type = OPTIONS_TABLE_STRING,
|
.type = OPTIONS_TABLE_STRING,
|
||||||
.default_str = "*88col*:colors=88,*256col*:colors=256"
|
.default_str = "*256col*:colors=256"
|
||||||
",xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007"
|
",xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007"
|
||||||
":Cc=\\E]12;%p1%s\\007:Cr=\\E]112\\007"
|
":Cc=\\E]12;%p1%s\\007:Cr=\\E]112\\007"
|
||||||
":Cs=\\E[%p1%d q:Csr=\\E[2 q,screen*:XT"
|
":Cs=\\E[%p1%d q:Csr=\\E[2 q,screen*:XT"
|
||||||
|
@ -488,6 +488,8 @@ screen_write_cursorup(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
if (ny > s->cy - s->rupper)
|
if (ny > s->cy - s->rupper)
|
||||||
ny = s->cy - s->rupper;
|
ny = s->cy - s->rupper;
|
||||||
}
|
}
|
||||||
|
if (s->cx == screen_size_x(s))
|
||||||
|
s->cx--;
|
||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -512,6 +514,8 @@ screen_write_cursordown(struct screen_write_ctx *ctx, u_int ny)
|
|||||||
if (ny > s->rlower - s->cy)
|
if (ny > s->rlower - s->cy)
|
||||||
ny = s->rlower - s->cy;
|
ny = s->rlower - s->cy;
|
||||||
}
|
}
|
||||||
|
if (s->cx == screen_size_x(s))
|
||||||
|
s->cx--;
|
||||||
if (ny == 0)
|
if (ny == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -534,18 +534,8 @@ server_client_check_resize(struct window_pane *wp)
|
|||||||
ws.ws_col = wp->sx;
|
ws.ws_col = wp->sx;
|
||||||
ws.ws_row = wp->sy;
|
ws.ws_row = wp->sy;
|
||||||
|
|
||||||
if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1) {
|
if (ioctl(wp->fd, TIOCSWINSZ, &ws) == -1)
|
||||||
#ifdef __sun
|
|
||||||
/*
|
|
||||||
* Some versions of Solaris apparently can return an error when
|
|
||||||
* resizing; don't know why this happens, can't reproduce on
|
|
||||||
* other platforms and ignoring it doesn't seem to cause any
|
|
||||||
* issues.
|
|
||||||
*/
|
|
||||||
if (errno != EINVAL)
|
|
||||||
#endif
|
|
||||||
fatal("ioctl failed");
|
fatal("ioctl failed");
|
||||||
}
|
|
||||||
|
|
||||||
wp->flags &= ~PANE_RESIZE;
|
wp->flags &= ~PANE_RESIZE;
|
||||||
}
|
}
|
||||||
@ -981,8 +971,6 @@ server_client_msg_identify(
|
|||||||
c->tty.flags |= TTY_UTF8;
|
c->tty.flags |= TTY_UTF8;
|
||||||
if (data->flags & IDENTIFY_256COLOURS)
|
if (data->flags & IDENTIFY_256COLOURS)
|
||||||
c->tty.term_flags |= TERM_256COLOURS;
|
c->tty.term_flags |= TERM_256COLOURS;
|
||||||
else if (data->flags & IDENTIFY_88COLOURS)
|
|
||||||
c->tty.term_flags |= TERM_88COLOURS;
|
|
||||||
|
|
||||||
tty_resize(&c->tty);
|
tty_resize(&c->tty);
|
||||||
|
|
||||||
|
16
tmux.1
16
tmux.1
@ -98,10 +98,6 @@ The options are as follows:
|
|||||||
Force
|
Force
|
||||||
.Nm
|
.Nm
|
||||||
to assume the terminal supports 256 colours.
|
to assume the terminal supports 256 colours.
|
||||||
.It Fl 8
|
|
||||||
Like
|
|
||||||
.Fl 2 ,
|
|
||||||
but indicates that the terminal supports 88 colours.
|
|
||||||
.It Fl C
|
.It Fl C
|
||||||
Start in control mode.
|
Start in control mode.
|
||||||
Given twice
|
Given twice
|
||||||
@ -145,11 +141,12 @@ session created, and continues to process the rest of the configuration file.
|
|||||||
.It Fl L Ar socket-name
|
.It Fl L Ar socket-name
|
||||||
.Nm
|
.Nm
|
||||||
stores the server socket in a directory under
|
stores the server socket in a directory under
|
||||||
.Pa /tmp
|
.Ev TMUX_TMPDIR ,
|
||||||
(or
|
|
||||||
.Ev TMPDIR
|
.Ev TMPDIR
|
||||||
if set);
|
if it is unset, or
|
||||||
the default socket is named
|
.Pa /tmp
|
||||||
|
if both are unset.
|
||||||
|
The default socket is named
|
||||||
.Em default .
|
.Em default .
|
||||||
This option allows a different socket name to be specified, allowing several
|
This option allows a different socket name to be specified, allowing several
|
||||||
independent
|
independent
|
||||||
@ -2652,7 +2649,7 @@ The default is
|
|||||||
.Ql \ -_@ .
|
.Ql \ -_@ .
|
||||||
.El
|
.El
|
||||||
.It Xo Ic set-window-option
|
.It Xo Ic set-window-option
|
||||||
.Op Fl agqu
|
.Op Fl agoqu
|
||||||
.Op Fl t Ar target-window
|
.Op Fl t Ar target-window
|
||||||
.Ar option Ar value
|
.Ar option Ar value
|
||||||
.Xc
|
.Xc
|
||||||
@ -2661,6 +2658,7 @@ Set a window option.
|
|||||||
The
|
The
|
||||||
.Fl a ,
|
.Fl a ,
|
||||||
.Fl g ,
|
.Fl g ,
|
||||||
|
.Fl o ,
|
||||||
.Fl q
|
.Fl q
|
||||||
and
|
and
|
||||||
.Fl u
|
.Fl u
|
||||||
|
19
tmux.c
19
tmux.c
@ -22,6 +22,8 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <event.h>
|
#include <event.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <paths.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -167,10 +169,12 @@ makesocketpath(const char *label)
|
|||||||
u_int uid;
|
u_int uid;
|
||||||
|
|
||||||
uid = getuid();
|
uid = getuid();
|
||||||
if ((s = getenv("TMPDIR")) == NULL || *s == '\0')
|
if ((s = getenv("TMUX_TMPDIR")) != NULL && *s != '\0')
|
||||||
xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid);
|
xsnprintf(base, sizeof base, "%s/", s);
|
||||||
else
|
else if ((s = getenv("TMPDIR")) != NULL && *s != '\0')
|
||||||
xsnprintf(base, sizeof base, "%s/tmux-%u", s, uid);
|
xsnprintf(base, sizeof base, "%s/tmux-%u", s, uid);
|
||||||
|
else
|
||||||
|
xsnprintf(base, sizeof base, "%s/tmux-%u", _PATH_TMP, uid);
|
||||||
|
|
||||||
if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST)
|
if (mkdir(base, S_IRWXU) != 0 && errno != EEXIST)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -244,18 +248,15 @@ main(int argc, char **argv)
|
|||||||
malloc_options = (char *) "AFGJPX";
|
malloc_options = (char *) "AFGJPX";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
setlocale(LC_TIME, "");
|
||||||
|
|
||||||
quiet = flags = 0;
|
quiet = flags = 0;
|
||||||
label = path = NULL;
|
label = path = NULL;
|
||||||
login_shell = (**argv == '-');
|
login_shell = (**argv == '-');
|
||||||
while ((opt = getopt(argc, argv, "28c:Cdf:lL:qS:uUvV")) != -1) {
|
while ((opt = getopt(argc, argv, "2c:Cdf:lL:qS:uUVv")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case '2':
|
case '2':
|
||||||
flags |= IDENTIFY_256COLOURS;
|
flags |= IDENTIFY_256COLOURS;
|
||||||
flags &= ~IDENTIFY_88COLOURS;
|
|
||||||
break;
|
|
||||||
case '8':
|
|
||||||
flags |= IDENTIFY_88COLOURS;
|
|
||||||
flags &= ~IDENTIFY_256COLOURS;
|
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
free(shell_cmd);
|
free(shell_cmd);
|
||||||
|
6
tmux.h
6
tmux.h
@ -477,7 +477,7 @@ struct msg_identify_data {
|
|||||||
|
|
||||||
#define IDENTIFY_UTF8 0x1
|
#define IDENTIFY_UTF8 0x1
|
||||||
#define IDENTIFY_256COLOURS 0x2
|
#define IDENTIFY_256COLOURS 0x2
|
||||||
#define IDENTIFY_88COLOURS 0x4
|
/* 0x4 unused */
|
||||||
#define IDENTIFY_CONTROL 0x8
|
#define IDENTIFY_CONTROL 0x8
|
||||||
#define IDENTIFY_TERMIOS 0x10
|
#define IDENTIFY_TERMIOS 0x10
|
||||||
int flags;
|
int flags;
|
||||||
@ -1137,8 +1137,7 @@ struct tty_term {
|
|||||||
struct tty_code codes[NTTYCODE];
|
struct tty_code codes[NTTYCODE];
|
||||||
|
|
||||||
#define TERM_256COLOURS 0x1
|
#define TERM_256COLOURS 0x1
|
||||||
#define TERM_88COLOURS 0x2
|
#define TERM_EARLYWRAP 0x2
|
||||||
#define TERM_EARLYWRAP 0x4
|
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
LIST_ENTRY(tty_term) entry;
|
LIST_ENTRY(tty_term) entry;
|
||||||
@ -1982,7 +1981,6 @@ void colour_set_bg(struct grid_cell *, int);
|
|||||||
const char *colour_tostring(int);
|
const char *colour_tostring(int);
|
||||||
int colour_fromstring(const char *);
|
int colour_fromstring(const char *);
|
||||||
u_char colour_256to16(u_char);
|
u_char colour_256to16(u_char);
|
||||||
u_char colour_256to88(u_char);
|
|
||||||
|
|
||||||
/* attributes.c */
|
/* attributes.c */
|
||||||
const char *attributes_tostring(u_char);
|
const char *attributes_tostring(u_char);
|
||||||
|
@ -410,11 +410,9 @@ tty_term_find(char *name, int fd, const char *overrides, char **cause)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out if we have 256 or 88 colours. */
|
/* Figure out if we have 256. */
|
||||||
if (tty_term_number(term, TTYC_COLORS) == 256)
|
if (tty_term_number(term, TTYC_COLORS) == 256)
|
||||||
term->flags |= TERM_256COLOURS;
|
term->flags |= TERM_256COLOURS;
|
||||||
if (tty_term_number(term, TTYC_COLORS) == 88)
|
|
||||||
term->flags |= TERM_88COLOURS;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Terminals without xenl (eat newline glitch) wrap at at $COLUMNS - 1
|
* Terminals without xenl (eat newline glitch) wrap at at $COLUMNS - 1
|
||||||
|
36
tty.c
36
tty.c
@ -35,7 +35,6 @@ void tty_read_callback(struct bufferevent *, void *);
|
|||||||
void tty_error_callback(struct bufferevent *, short, void *);
|
void tty_error_callback(struct bufferevent *, short, void *);
|
||||||
|
|
||||||
int tty_try_256(struct tty *, u_char, const char *);
|
int tty_try_256(struct tty *, u_char, const char *);
|
||||||
int tty_try_88(struct tty *, u_char, const char *);
|
|
||||||
|
|
||||||
void tty_colours(struct tty *, const struct grid_cell *);
|
void tty_colours(struct tty *, const struct grid_cell *);
|
||||||
void tty_check_fg(struct tty *, struct grid_cell *);
|
void tty_check_fg(struct tty *, struct grid_cell *);
|
||||||
@ -221,7 +220,7 @@ tty_start_tty(struct tty *tty)
|
|||||||
tty_puts(tty, "\033[?1000l\033[?1006l\033[?1005l");
|
tty_puts(tty, "\033[?1000l\033[?1006l\033[?1005l");
|
||||||
|
|
||||||
if (tty_term_has(tty->term, TTYC_XT))
|
if (tty_term_has(tty->term, TTYC_XT))
|
||||||
tty_puts(tty, "\033[c\033[>4;1m\033[?1004h");
|
tty_puts(tty, "\033[c\033[>4;1m\033[?1004h\033[m");
|
||||||
|
|
||||||
tty->cx = UINT_MAX;
|
tty->cx = UINT_MAX;
|
||||||
tty->cy = UINT_MAX;
|
tty->cy = UINT_MAX;
|
||||||
@ -284,7 +283,7 @@ tty_stop_tty(struct tty *tty)
|
|||||||
tty_raw(tty, "\033[?1000l\033[?1006l\033[?1005l");
|
tty_raw(tty, "\033[?1000l\033[?1006l\033[?1005l");
|
||||||
|
|
||||||
if (tty_term_has(tty->term, TTYC_XT))
|
if (tty_term_has(tty->term, TTYC_XT))
|
||||||
tty_raw(tty, "\033[>4m\033[?1004l");
|
tty_raw(tty, "\033[>4m\033[?1004l\033[m");
|
||||||
|
|
||||||
tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
|
tty_raw(tty, tty_term_string(tty->term, TTYC_RMCUP));
|
||||||
|
|
||||||
@ -1446,9 +1445,7 @@ tty_check_fg(struct tty *tty, struct grid_cell *gc)
|
|||||||
/* Is this a 256-colour colour? */
|
/* Is this a 256-colour colour? */
|
||||||
if (gc->flags & GRID_FLAG_FG256) {
|
if (gc->flags & GRID_FLAG_FG256) {
|
||||||
/* And not a 256 colour mode? */
|
/* And not a 256 colour mode? */
|
||||||
if (!(tty->term->flags & TERM_88COLOURS) &&
|
if (!(tty->term->flags & TERM_256COLOURS) &&
|
||||||
!(tty->term_flags & TERM_88COLOURS) &&
|
|
||||||
!(tty->term->flags & TERM_256COLOURS) &&
|
|
||||||
!(tty->term_flags & TERM_256COLOURS)) {
|
!(tty->term_flags & TERM_256COLOURS)) {
|
||||||
gc->fg = colour_256to16(gc->fg);
|
gc->fg = colour_256to16(gc->fg);
|
||||||
if (gc->fg & 8) {
|
if (gc->fg & 8) {
|
||||||
@ -1481,9 +1478,7 @@ tty_check_bg(struct tty *tty, struct grid_cell *gc)
|
|||||||
* palette. Bold background doesn't exist portably, so just
|
* palette. Bold background doesn't exist portably, so just
|
||||||
* discard the bold bit if set.
|
* discard the bold bit if set.
|
||||||
*/
|
*/
|
||||||
if (!(tty->term->flags & TERM_88COLOURS) &&
|
if (!(tty->term->flags & TERM_256COLOURS) &&
|
||||||
!(tty->term_flags & TERM_88COLOURS) &&
|
|
||||||
!(tty->term->flags & TERM_256COLOURS) &&
|
|
||||||
!(tty->term_flags & TERM_256COLOURS)) {
|
!(tty->term_flags & TERM_256COLOURS)) {
|
||||||
gc->bg = colour_256to16(gc->bg);
|
gc->bg = colour_256to16(gc->bg);
|
||||||
if (gc->bg & 8)
|
if (gc->bg & 8)
|
||||||
@ -1511,11 +1506,9 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
|
|
||||||
/* Is this a 256-colour colour? */
|
/* Is this a 256-colour colour? */
|
||||||
if (gc->flags & GRID_FLAG_FG256) {
|
if (gc->flags & GRID_FLAG_FG256) {
|
||||||
/* Try as 256 colours or translating to 88. */
|
/* Try as 256 colours. */
|
||||||
if (tty_try_256(tty, fg, "38") == 0)
|
if (tty_try_256(tty, fg, "38") == 0)
|
||||||
goto save_fg;
|
goto save_fg;
|
||||||
if (tty_try_88(tty, fg, "38") == 0)
|
|
||||||
goto save_fg;
|
|
||||||
/* Else already handled by tty_check_fg. */
|
/* Else already handled by tty_check_fg. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1546,11 +1539,9 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
|
|
||||||
/* Is this a 256-colour colour? */
|
/* Is this a 256-colour colour? */
|
||||||
if (gc->flags & GRID_FLAG_BG256) {
|
if (gc->flags & GRID_FLAG_BG256) {
|
||||||
/* Try as 256 colours or translating to 88. */
|
/* Try as 256 colours. */
|
||||||
if (tty_try_256(tty, bg, "48") == 0)
|
if (tty_try_256(tty, bg, "48") == 0)
|
||||||
goto save_bg;
|
goto save_bg;
|
||||||
if (tty_try_88(tty, bg, "48") == 0)
|
|
||||||
goto save_bg;
|
|
||||||
/* Else already handled by tty_check_bg. */
|
/* Else already handled by tty_check_bg. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1591,21 +1582,6 @@ tty_try_256(struct tty *tty, u_char colour, const char *type)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
tty_try_88(struct tty *tty, u_char colour, const char *type)
|
|
||||||
{
|
|
||||||
char s[32];
|
|
||||||
|
|
||||||
if (!(tty->term->flags & TERM_88COLOURS) &&
|
|
||||||
!(tty->term_flags & TERM_88COLOURS))
|
|
||||||
return (-1);
|
|
||||||
colour = colour_256to88(colour);
|
|
||||||
|
|
||||||
xsnprintf(s, sizeof s, "\033[%s;5;%hhum", type, colour);
|
|
||||||
tty_puts(tty, s);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
tty_bell(struct tty *tty)
|
tty_bell(struct tty *tty)
|
||||||
{
|
{
|
||||||
|
1
utf8.c
1
utf8.c
@ -173,7 +173,6 @@ struct utf8_width_entry utf8_width_table[] = {
|
|||||||
{ 0x30000, 0x3fffd, 2, NULL, NULL },
|
{ 0x30000, 0x3fffd, 2, NULL, NULL },
|
||||||
{ 0x00711, 0x00711, 0, NULL, NULL },
|
{ 0x00711, 0x00711, 0, NULL, NULL },
|
||||||
{ 0x0fe00, 0x0fe0f, 0, NULL, NULL },
|
{ 0x0fe00, 0x0fe0f, 0, NULL, NULL },
|
||||||
{ 0x01160, 0x011ff, 0, NULL, NULL },
|
|
||||||
{ 0x0180b, 0x0180d, 0, NULL, NULL },
|
{ 0x0180b, 0x0180d, 0, NULL, NULL },
|
||||||
{ 0x10a3f, 0x10a3f, 0, NULL, NULL },
|
{ 0x10a3f, 0x10a3f, 0, NULL, NULL },
|
||||||
{ 0x00981, 0x00981, 0, NULL, NULL },
|
{ 0x00981, 0x00981, 0, NULL, NULL },
|
||||||
|
Loading…
Reference in New Issue
Block a user