status-lines -> status, prefix-key -> prefix

This commit is contained in:
Nicholas Marriott 2008-06-19 22:04:02 +00:00
parent 24cc3626dc
commit 73d1558ed0
10 changed files with 41 additions and 34 deletions

View File

@ -1,5 +1,7 @@
19 June 2008
* Use "status" consistently for status line option, and prefix for "prefix" key
option.
* Allow commands to be entered at a prompt. This is triggered with the
command-prompt command, bound to : by default.
* Show status messages properly, without blocking the server.
@ -509,4 +511,4 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
$Id: CHANGES,v 1.127 2008-06-19 20:45:15 nicm Exp $
$Id: CHANGES,v 1.128 2008-06-19 22:04:01 nicm Exp $

3
TODO
View File

@ -75,3 +75,6 @@
- configurable error/info display time
- tidy up window modes
- support \033_string\033\\ for window title too
- fix bell-action in show-window
- replace status-lines with status internally too
- list-keys should be sorted

View File

@ -1,4 +1,4 @@
/* $Id: cmd-new-session.c,v 1.28 2008-06-18 16:39:15 nicm Exp $ */
/* $Id: cmd-new-session.c,v 1.29 2008-06-19 22:04:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -116,7 +116,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
struct client *c = ctx->cmdclient;
struct session *s;
char *cmd, *cause;
u_int sx, sy, slines;
u_int sx, sy;
if (ctx->flags & CMD_KEY)
return;
@ -148,10 +148,12 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
sy = c->sy;
}
slines = options_get_number(&global_options, "status-lines");
if (sy < slines)
sy = slines + 1;
sy -= slines;
if (options_get_number(&global_options, "status")) {
if (sy == 0)
sy = 1;
else
sy--;
}
if (!data->flag_detached && tty_open(&c->tty, &cause) != 0) {
ctx->error(ctx, "%s", cause);

View File

@ -1,4 +1,4 @@
/* $Id: cmd-send-prefix.c,v 1.15 2008-06-15 08:01:54 nicm Exp $ */
/* $Id: cmd-send-prefix.c,v 1.16 2008-06-19 22:04:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -49,7 +49,7 @@ cmd_send_prefix_exec(struct cmd *self, struct cmd_ctx *ctx)
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
return;
window_key(wl->window, options_get_key(&s->options, "prefix-key"));
window_key(wl->window, options_get_key(&s->options, "prefix"));
if (ctx->cmdclient != NULL)
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);

View File

@ -1,4 +1,4 @@
/* $Id: cmd-set-option.c,v 1.31 2008-06-18 22:21:51 nicm Exp $ */
/* $Id: cmd-set-option.c,v 1.32 2008-06-19 22:04:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -148,15 +148,15 @@ cmd_set_option_exec(struct cmd *self, unused struct cmd_ctx *ctx)
ctx->error(ctx, "unknown key: %s", data->value);
return;
}
options_set_key(oo, "prefix-key", key);
options_set_key(oo, "prefix", key);
} else if (strcmp(data->option, "status") == 0) {
if (flag == -1) {
ctx->error(ctx, "bad value: %s", data->value);
return;
}
if (flag == -2)
flag = !options_get_number(oo, "status-lines");
options_set_number(oo, "status-lines", flag);
flag = !options_get_number(oo, "status");
options_set_number(oo, "status", flag);
recalculate_sizes();
} else if (strcmp(data->option, "status-fg") == 0) {
if (data->value == NULL) {

View File

@ -1,4 +1,4 @@
/* $Id: resize.c,v 1.15 2008-06-14 16:47:20 nicm Exp $ */
/* $Id: resize.c,v 1.16 2008-06-19 22:04:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -48,7 +48,7 @@ recalculate_sizes(void)
struct session *s;
struct client *c;
struct window *w;
u_int i, j, ssx, ssy, slines, has;
u_int i, j, ssx, ssy, has;
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
s = ARRAY_ITEM(&sessions, i);
@ -73,10 +73,12 @@ recalculate_sizes(void)
}
s->flags &= ~SESSION_UNATTACHED;
slines = options_get_number(&s->options, "status-lines");
if (ssy < slines)
ssy = slines + 1;
ssy -= slines;
if (options_get_number(&s->options, "status")) {
if (ssy == 0)
ssy = 1;
else
ssy--;
}
if (s->sx == ssx && s->sy == ssy)
continue;

View File

@ -1,4 +1,4 @@
/* $Id: server.c,v 1.70 2008-06-19 19:40:34 nicm Exp $ */
/* $Id: server.c,v 1.71 2008-06-19 22:04:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -322,7 +322,7 @@ server_check_redraw(struct client *c)
}
xx = c->sx;
yy = c->sy - 1; //options_get_number(&s->options, "status-lines");
yy = c->sy - 1;
if (c->flags & CLIENT_REDRAW) {
sx = screen_size_x(s->curw->window->screen);
sy = screen_size_y(s->curw->window->screen);
@ -372,7 +372,7 @@ server_check_timers(struct client *c)
{
struct session *s;
struct timespec ts, ts2;
u_int nlines, interval;
u_int interval;
if (c == NULL || c->session == NULL)
return;
@ -384,8 +384,7 @@ server_check_timers(struct client *c)
if (c->message_string != NULL && timespeccmp(&ts, &c->message_timer, >))
server_clear_client_message(c);
nlines = options_get_number(&s->options, "status-lines");
if (nlines == 0)
if (!options_get_number(&s->options, "status"))
return;
interval = options_get_number(&s->options, "status-interval");
if (interval == 0)
@ -522,7 +521,7 @@ server_handle_client(struct client *c)
struct window *w = c->session->curw->window;
int key, prefix;
prefix = options_get_key(&c->session->options, "prefix-key");
prefix = options_get_key(&c->session->options, "prefix");
while (tty_keys_next(&c->tty, &key) == 0) {
server_clear_client_message(c);
if (c->prompt_string != NULL) {

View File

@ -1,4 +1,4 @@
/* $Id: status.c,v 1.34 2008-06-19 20:53:04 nicm Exp $ */
/* $Id: status.c,v 1.35 2008-06-19 22:04:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -42,8 +42,7 @@ status_redraw(struct client *c)
struct tm *tm;
int larrow, rarrow;
yy = options_get_number(&s->options, "status-lines");
if (c->sy == 0 || yy == 0)
if (c->sy == 0 || !options_get_number(&s->options, "status"))
goto off;
larrow = rarrow = 0;
@ -51,7 +50,7 @@ status_redraw(struct client *c)
fatal("clock_gettime failed");
colr = options_get_colours(&s->options, "status-colour");
yy = c->sy - yy;
yy = c->sy - 1;
if (yy == 0)
goto blank;

4
tmux.1
View File

@ -1,4 +1,4 @@
.\" $Id: tmux.1,v 1.40 2008-06-19 21:45:46 nicm Exp $
.\" $Id: tmux.1,v 1.41 2008-06-19 22:04:02 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@ -569,7 +569,7 @@ The default is
Set the maximum number of lines held in window history.
This setting applies only to new windows - existing window histories are not
resized and retain the limit at the point they were created.
.It Ic prefix-key Ar key
.It Ic prefix Ar key
Set the current prefix key.
.It Xo Ic status
.Op Ic on | Ic off

6
tmux.c
View File

@ -1,4 +1,4 @@
/* $Id: tmux.c,v 1.62 2008-06-19 19:40:35 nicm Exp $ */
/* $Id: tmux.c,v 1.63 2008-06-19 22:04:02 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -210,11 +210,11 @@ main(int argc, char **argv)
siginit();
options_init(&global_options, NULL);
options_set_number(&global_options, "status-lines", 1);
options_set_number(&global_options, "status", 1);
options_set_colours(&global_options, "status-colour", 0x02);
options_set_number(&global_options, "bell-action", BELL_ANY);
options_set_number(&global_options, "history-limit", 2000);
options_set_key(&global_options, "prefix-key", META);
options_set_key(&global_options, "prefix", META);
options_set_string(&global_options, "status-left", "%s", ""); /* ugh */
options_set_string(
&global_options, "status-right", "%%H:%%M %%d-%%b-%%y");