mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
It is too easy to create things in the same second; use a timespec instead.
This commit is contained in:
parent
743956edf8
commit
73c9b25d2d
8
TODO
8
TODO
@ -39,10 +39,6 @@
|
|||||||
buffer manip: clear, view etc (clear-buffer, show-buffer)
|
buffer manip: clear, view etc (clear-buffer, show-buffer)
|
||||||
- function groups, bind-key ^W { select-window 0; send-key ^W } etc ***
|
- function groups, bind-key ^W { select-window 0; send-key ^W } etc ***
|
||||||
- allow fnmatch for -c, so that you can, eg, detach all clients
|
- allow fnmatch for -c, so that you can, eg, detach all clients
|
||||||
- session specification is all over the place. some things use -s before cmd,
|
|
||||||
some -s after, some no -s, there are various uses of -n. the differences are
|
|
||||||
sort of logical, but confusing. needs rethought
|
|
||||||
- XXX should -i for win idx be before cmd too??
|
|
||||||
- bind non prefix keys
|
- bind non prefix keys
|
||||||
- stuff like rename would be nice to be able to do in-client like screen, if
|
- stuff like rename would be nice to be able to do in-client like screen, if
|
||||||
it could be implemented in a non-icky way
|
it could be implemented in a non-icky way
|
||||||
@ -67,8 +63,8 @@
|
|||||||
- tobiasu says it is borken on Linux with aterm + TERM=rxvt
|
- tobiasu says it is borken on Linux with aterm + TERM=rxvt
|
||||||
- poll(2) is broken on OS X/Darwin, a workaround for this would be nice
|
- poll(2) is broken on OS X/Darwin, a workaround for this would be nice
|
||||||
- different screen model? layers perhaps? hmm
|
- different screen model? layers perhaps? hmm
|
||||||
- cfg file improvements: * comments to EOL
|
- cfg file improvements
|
||||||
- select-window can become windowonly...
|
- select-window can become windowonly (what about default?)
|
||||||
|
|
||||||
---
|
---
|
||||||
[18:20] *priteau* i found something in tmux that could be tweaked to be better
|
[18:20] *priteau* i found something in tmux that could be tweaked to be better
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-kill-server.c,v 1.2 2008-06-03 05:35:50 nicm Exp $ */
|
/* $Id: cmd-kill-server.c,v 1.3 2008-06-03 18:13:54 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -44,7 +44,7 @@ const struct cmd_entry cmd_kill_server_entry = {
|
|||||||
void
|
void
|
||||||
cmd_kill_server_exec(unused void *ptr, struct cmd_ctx *ctx)
|
cmd_kill_server_exec(unused void *ptr, struct cmd_ctx *ctx)
|
||||||
{
|
{
|
||||||
kill(getpid(), SIGTERM);
|
sigterm = 1;
|
||||||
|
|
||||||
if (ctx->cmdclient != NULL)
|
if (ctx->cmdclient != NULL)
|
||||||
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
|
server_write_client(ctx->cmdclient, MSG_EXIT, NULL, 0);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-list-sessions.c,v 1.12 2008-06-03 05:35:51 nicm Exp $ */
|
/* $Id: cmd-list-sessions.c,v 1.13 2008-06-03 18:13:54 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -56,7 +56,7 @@ cmd_list_sessions_exec(unused void *ptr, struct cmd_ctx *ctx)
|
|||||||
n = 0;
|
n = 0;
|
||||||
RB_FOREACH(wl, winlinks, &s->windows)
|
RB_FOREACH(wl, winlinks, &s->windows)
|
||||||
n++;
|
n++;
|
||||||
tim = ctime(&s->tim);
|
tim = ctime(&s->ts.tv_sec);
|
||||||
*strchr(tim, '\n') = '\0';
|
*strchr(tim, '\n') = '\0';
|
||||||
|
|
||||||
ctx->print(ctx, "%s: %u windows"
|
ctx->print(ctx, "%s: %u windows"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-switch-client.c,v 1.5 2008-06-03 05:35:51 nicm Exp $ */
|
/* $Id: cmd-switch-client.c,v 1.6 2008-06-03 18:13:54 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -41,7 +41,7 @@ struct cmd_switch_client_data {
|
|||||||
|
|
||||||
const struct cmd_entry cmd_switch_client_entry = {
|
const struct cmd_entry cmd_switch_client_entry = {
|
||||||
"switch-client", "switchc",
|
"switch-client", "switchc",
|
||||||
"session-name",
|
"[-c client-tty] session-name",
|
||||||
0,
|
0,
|
||||||
cmd_switch_client_parse,
|
cmd_switch_client_parse,
|
||||||
cmd_switch_client_exec,
|
cmd_switch_client_exec,
|
||||||
|
19
cmd.c
19
cmd.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd.c,v 1.39 2008-06-03 16:55:09 nicm Exp $ */
|
/* $Id: cmd.c,v 1.40 2008-06-03 18:13:54 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -253,18 +254,18 @@ struct session *
|
|||||||
cmd_lookup_session(const char *sname)
|
cmd_lookup_session(const char *sname)
|
||||||
{
|
{
|
||||||
struct session *s, *newest = NULL;
|
struct session *s, *newest = NULL;
|
||||||
time_t tim;
|
struct timespec *ts;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
tim = 0;
|
ts = NULL;
|
||||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||||
s = ARRAY_ITEM(&sessions, i);
|
s = ARRAY_ITEM(&sessions, i);
|
||||||
if (s == NULL || fnmatch(sname, s->name, 0) != 0)
|
if (s == NULL || fnmatch(sname, s->name, 0) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (s->tim > tim) {
|
if (ts == NULL || timespeccmp(&s->ts, ts, >)) {
|
||||||
newest = s;
|
newest = s;
|
||||||
tim = s->tim;
|
ts = &s->ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +306,7 @@ cmd_find_session(struct cmd_ctx *ctx, const char *cname, const char *sname)
|
|||||||
struct client *c;
|
struct client *c;
|
||||||
struct msg_command_data *data = ctx->msgdata;
|
struct msg_command_data *data = ctx->msgdata;
|
||||||
u_int i;
|
u_int i;
|
||||||
time_t tim;
|
struct timespec *ts;
|
||||||
|
|
||||||
if (cname != NULL) {
|
if (cname != NULL) {
|
||||||
if ((c = cmd_lookup_client(cname)) == NULL) {
|
if ((c = cmd_lookup_client(cname)) == NULL) {
|
||||||
@ -342,12 +343,12 @@ cmd_find_session(struct cmd_ctx *ctx, const char *cname, const char *sname)
|
|||||||
return (s);
|
return (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
tim = 0;
|
ts = NULL;
|
||||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||||
s = ARRAY_ITEM(&sessions, i);
|
s = ARRAY_ITEM(&sessions, i);
|
||||||
if (s != NULL && s->tim > tim) {
|
if (s != NULL && (ts == NULL || timespeccmp(&s->ts, ts, >))) {
|
||||||
newest = ARRAY_ITEM(&sessions, i);
|
newest = ARRAY_ITEM(&sessions, i);
|
||||||
tim = s->tim;
|
ts = &s->ts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newest == NULL)
|
if (newest == NULL)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: session.c,v 1.31 2008-06-02 21:08:36 nicm Exp $ */
|
/* $Id: session.c,v 1.32 2008-06-03 18:13:54 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
@ -90,7 +90,8 @@ session_create(const char *name, const char *cmd, u_int sx, u_int sy)
|
|||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
s = xmalloc(sizeof *s);
|
s = xmalloc(sizeof *s);
|
||||||
s->tim = time(NULL);
|
if (clock_gettime(CLOCK_REALTIME, &s->ts) != 0)
|
||||||
|
fatal("clock_gettime");
|
||||||
s->curw = s->lastw = NULL;
|
s->curw = s->lastw = NULL;
|
||||||
RB_INIT(&s->windows);
|
RB_INIT(&s->windows);
|
||||||
ARRAY_INIT(&s->bells);
|
ARRAY_INIT(&s->bells);
|
||||||
|
4
tmux.c
4
tmux.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.c,v 1.49 2008-06-03 05:35:51 nicm Exp $ */
|
/* $Id: tmux.c,v 1.50 2008-06-03 18:13:54 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -59,7 +59,7 @@ __dead void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: %s [-v] [-f file] [-S socket-path] [command [flags]]",
|
"usage: %s [-v] [-f file] [-S socket-path] [command [flags]]\n",
|
||||||
__progname);
|
__progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
4
tmux.h
4
tmux.h
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tmux.h,v 1.123 2008-06-03 16:55:09 nicm Exp $ */
|
/* $Id: tmux.h,v 1.124 2008-06-03 18:13:54 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -536,7 +536,7 @@ RB_HEAD(winlinks, winlink);
|
|||||||
/* Client session. */
|
/* Client session. */
|
||||||
struct session {
|
struct session {
|
||||||
char *name;
|
char *name;
|
||||||
time_t tim;
|
struct timespec ts;
|
||||||
|
|
||||||
u_int sx;
|
u_int sx;
|
||||||
u_int sy;
|
u_int sy;
|
||||||
|
Loading…
Reference in New Issue
Block a user