mirror of
https://github.com/tmate-io/tmate.git
synced 2025-01-11 16:38:47 +01:00
Better OSC support for title setting, and support APC as well.
This commit is contained in:
parent
23e7da1ccb
commit
185f7297e8
8
CHANGES
8
CHANGES
@ -1,3 +1,9 @@
|
||||
09 October 2008
|
||||
|
||||
* Better support for OSC command (only to set window title now), and also
|
||||
support using APC for the same purpose (some Linux default shell profiles do
|
||||
this).
|
||||
|
||||
25 September 2008
|
||||
|
||||
* Large internal rewrite to better support 256 colours and UTF-8. Screen data
|
||||
@ -674,4 +680,4 @@
|
||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||
customisation.
|
||||
|
||||
$Id: CHANGES,v 1.162 2008-09-26 06:45:25 nicm Exp $
|
||||
$Id: CHANGES,v 1.163 2008-10-09 21:22:16 nicm Exp $
|
||||
|
1
TODO
1
TODO
@ -46,7 +46,6 @@
|
||||
- activity/bell should be per-window not per-link? what if it is cur win in
|
||||
session not being watched?
|
||||
- tidy up window modes
|
||||
- support \033_string\033\\ for window title too
|
||||
- list-keys should be sorted
|
||||
- problems with force-width when wrapping line in emacs?
|
||||
- command history for command-prompt. better tab completion (use options too)
|
||||
|
100
input.c
100
input.c
@ -1,4 +1,4 @@
|
||||
/* $Id: input.c,v 1.62 2008-09-26 07:41:01 nicm Exp $ */
|
||||
/* $Id: input.c,v 1.63 2008-10-09 21:22:16 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -48,9 +48,6 @@ void input_state(struct input_ctx *, void *);
|
||||
void input_state_first(u_char, struct input_ctx *);
|
||||
void input_state_escape(u_char, struct input_ctx *);
|
||||
void input_state_intermediate(u_char, struct input_ctx *);
|
||||
void input_state_title_first(u_char, struct input_ctx *);
|
||||
void input_state_title_second(u_char, struct input_ctx *);
|
||||
void input_state_title_next(u_char, struct input_ctx *);
|
||||
void input_state_sequence_first(u_char, struct input_ctx *);
|
||||
void input_state_sequence_next(u_char, struct input_ctx *);
|
||||
void input_state_sequence_intermediate(u_char, struct input_ctx *);
|
||||
@ -261,9 +258,13 @@ input_state_first(u_char ch, struct input_ctx *ictx)
|
||||
ch -= 0x40;
|
||||
if (ch == '[')
|
||||
input_state(ictx, input_state_sequence_first);
|
||||
else if (ch == ']')
|
||||
input_state(ictx, input_state_title_first);
|
||||
else
|
||||
else if (ch == ']') {
|
||||
input_start_string(ictx, STRING_SYSTEM);
|
||||
input_state(ictx, input_state_string_next);
|
||||
} else if (ch == '_') {
|
||||
input_start_string(ictx, STRING_APPLICATION);
|
||||
input_state(ictx, input_state_string_next);
|
||||
} else
|
||||
input_handle_c1_control(ch, ictx);
|
||||
return;
|
||||
}
|
||||
@ -301,9 +302,13 @@ input_state_escape(u_char ch, struct input_ctx *ictx)
|
||||
if (INPUT_UPPERCASE(ch)) {
|
||||
if (ch == '[')
|
||||
input_state(ictx, input_state_sequence_first);
|
||||
else if (ch == ']')
|
||||
input_state(ictx, input_state_title_first);
|
||||
else {
|
||||
else if (ch == ']') {
|
||||
input_start_string(ictx, STRING_SYSTEM);
|
||||
input_state(ictx, input_state_string_next);
|
||||
} else if (ch == '_') {
|
||||
input_start_string(ictx, STRING_APPLICATION);
|
||||
input_state(ictx, input_state_string_next);
|
||||
} else {
|
||||
input_state(ictx, input_state_first);
|
||||
input_handle_c1_control(ch, ictx);
|
||||
}
|
||||
@ -319,53 +324,6 @@ input_state_escape(u_char ch, struct input_ctx *ictx)
|
||||
input_state(ictx, input_state_first);
|
||||
}
|
||||
|
||||
void
|
||||
input_state_title_first(u_char ch, struct input_ctx *ictx)
|
||||
{
|
||||
if (ch >= '0' && ch <= '9') {
|
||||
if (ch == '0')
|
||||
input_start_string(ictx, STRING_TITLE);
|
||||
else
|
||||
input_start_string(ictx, STRING_IGNORE);
|
||||
input_state(ictx, input_state_title_second);
|
||||
return;
|
||||
}
|
||||
|
||||
input_state(ictx, input_state_first);
|
||||
}
|
||||
|
||||
void
|
||||
input_state_title_second(u_char ch, struct input_ctx *ictx)
|
||||
{
|
||||
if (ch == ';') {
|
||||
input_state(ictx, input_state_title_next);
|
||||
return;
|
||||
}
|
||||
|
||||
input_state(ictx, input_state_first);
|
||||
}
|
||||
|
||||
void
|
||||
input_state_title_next(u_char ch, struct input_ctx *ictx)
|
||||
{
|
||||
if (ch == '\007') {
|
||||
if (ictx->string_type == STRING_TITLE)
|
||||
screen_set_title(ictx->ctx.s, input_get_string(ictx));
|
||||
else
|
||||
input_abort_string(ictx);
|
||||
input_state(ictx, input_state_first);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch >= 0x20 && ch != 0x7f) {
|
||||
if (input_add_string(ictx, ch) != 0)
|
||||
input_state(ictx, input_state_first);
|
||||
return;
|
||||
}
|
||||
|
||||
input_state(ictx, input_state_first);
|
||||
}
|
||||
|
||||
void
|
||||
input_state_intermediate(u_char ch, struct input_ctx *ictx)
|
||||
{
|
||||
@ -467,6 +425,10 @@ input_state_string_next(u_char ch, struct input_ctx *ictx)
|
||||
input_state(ictx, input_state_string_escape);
|
||||
return;
|
||||
}
|
||||
if (ch == 0x07) {
|
||||
input_state_string_escape(ch, ictx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ch >= 0x20 && ch != 0x7f) {
|
||||
if (input_add_string(ictx, ch) != 0)
|
||||
@ -478,10 +440,32 @@ input_state_string_next(u_char ch, struct input_ctx *ictx)
|
||||
void
|
||||
input_state_string_escape(u_char ch, struct input_ctx *ictx)
|
||||
{
|
||||
if (ch == '\\') {
|
||||
char *s;
|
||||
|
||||
if (ch == '\007' || ch == '\\') {
|
||||
input_state(ictx, input_state_first);
|
||||
switch (ictx->string_type) {
|
||||
case STRING_SYSTEM:
|
||||
if (ch != '\007')
|
||||
return;
|
||||
s = input_get_string(ictx);
|
||||
if ((s[0] != '0' && s[0] != '2') || s[1] != ';') {
|
||||
xfree(s);
|
||||
return;
|
||||
}
|
||||
screen_set_title(ictx->ctx.s, s + 2);
|
||||
xfree(s);
|
||||
break;
|
||||
case STRING_APPLICATION:
|
||||
if (ch != '\\')
|
||||
return;
|
||||
s = input_get_string(ictx);
|
||||
screen_set_title(ictx->ctx.s, s);
|
||||
xfree(s);
|
||||
break;
|
||||
case STRING_NAME:
|
||||
if (ch != '\\')
|
||||
return;
|
||||
xfree(ictx->w->name);
|
||||
ictx->w->name = input_get_string(ictx);
|
||||
server_status_window(ictx->w);
|
||||
|
8
tmux.h
8
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.191 2008-09-26 06:45:28 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.192 2008-10-09 21:22:16 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -524,9 +524,9 @@ struct input_ctx {
|
||||
u_char *string_buf;
|
||||
size_t string_len;
|
||||
int string_type;
|
||||
#define STRING_TITLE 0
|
||||
#define STRING_NAME 1
|
||||
#define STRING_IGNORE 2
|
||||
#define STRING_SYSTEM 0
|
||||
#define STRING_APPLICATION 1
|
||||
#define STRING_NAME 2
|
||||
|
||||
u_char utf8_buf[4];
|
||||
u_int utf8_len;
|
||||
|
Loading…
Reference in New Issue
Block a user