mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-25 16:19:02 +01:00
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Conflicts: Makefile.am
This commit is contained in:
commit
907ad00300
11
Makefile.am
11
Makefile.am
@ -13,7 +13,7 @@ dist-hook:
|
||||
find $(distdir) -name .svn -type d|xargs rm -Rf
|
||||
|
||||
# Preprocessor flags.
|
||||
CPPFLAGS += @XOPEN_DEFINES@
|
||||
CPPFLAGS += @XOPEN_DEFINES@ -DTMUX_CONF="\"$(sysconfdir)/tmux.conf\""
|
||||
|
||||
# glibc as usual does things ass-backwards and hides useful things by default,
|
||||
# so everyone has to add this.
|
||||
@ -238,12 +238,15 @@ endif
|
||||
# Install tmux.1 in the right format.
|
||||
install-exec-hook:
|
||||
if test x@MANFORMAT@ = xmdoc; then \
|
||||
cp tmux.1 tmux.1.mdoc; \
|
||||
sed -e "s|@SYSCONFDIR@|$(sysconfdir)|g" $(srcdir)/tmux.1 \
|
||||
>$(srcdir)/tmux.1.mdoc; \
|
||||
else \
|
||||
$(AWK) -fmdoc2man.awk <tmux.1 >tmux.1.man; \
|
||||
sed -e "s|@SYSCONFDIR@|$(sysconfdir)|g" $(srcdir)/tmux.1| \
|
||||
$(AWK) -fmdoc2man.awk >$(srcdir)/tmux.1.man; \
|
||||
fi
|
||||
$(MKDIR_P) $(DESTDIR)$(mandir)/man1
|
||||
$(INSTALL_DATA) tmux.1.@MANFORMAT@ $(DESTDIR)$(mandir)/man1/tmux.1
|
||||
$(INSTALL_DATA) $(srcdir)/tmux.1.@MANFORMAT@ \
|
||||
$(DESTDIR)$(mandir)/man1/tmux.1
|
||||
|
||||
# Update SF web site.
|
||||
upload-index.html: update-index.html
|
||||
|
4
client.c
4
client.c
@ -78,8 +78,8 @@ client_get_lock(char *lockfile)
|
||||
if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1)
|
||||
fatal("open failed");
|
||||
|
||||
if (flock(lockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
|
||||
while (flock(lockfd, LOCK_EX) == -1 && errno == EINTR)
|
||||
if (lockf(lockfd, F_TLOCK, 0) == -1 && errno == EAGAIN) {
|
||||
while (lockf(lockfd, F_LOCK, 0) == -1 && errno == EINTR)
|
||||
/* nothing */;
|
||||
close(lockfd);
|
||||
return (-1);
|
||||
|
@ -89,10 +89,7 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
|
||||
if ((s = c->session) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), NULL)) == NULL)
|
||||
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL)
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
||||
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
|
||||
@ -231,9 +228,12 @@ windows_only:
|
||||
free(final_win_template_last);
|
||||
|
||||
window_choose_ready(wl->window->active, cur_win, NULL);
|
||||
window_choose_collapse_all(wl->window->active);
|
||||
|
||||
if (args_has(args, 'u'))
|
||||
if (args_has(args, 'u')) {
|
||||
window_choose_expand_all(wl->window->active);
|
||||
window_choose_set_current(wl->window->active, cur_win);
|
||||
}
|
||||
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
@ -18,6 +18,9 @@ AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_INSTALL
|
||||
|
||||
# Default tmux.conf goes in /etc not ${prefix}/etc.
|
||||
test "$sysconfdir" = '${prefix}/etc' && sysconfdir=/etc
|
||||
|
||||
# Check for various headers. Alternatives included from compat.h.
|
||||
AC_CHECK_HEADERS(
|
||||
[ \
|
||||
|
6
format.c
6
format.c
@ -288,7 +288,7 @@ format_session(struct format_tree *ft, struct session *s)
|
||||
format_add(ft, "session_group", "%u", session_group_index(sg));
|
||||
|
||||
t = s->creation_time.tv_sec;
|
||||
format_add(ft, "session_created", "%ld", (long) t);
|
||||
format_add(ft, "session_created", "%lld", (long long) t);
|
||||
tim = ctime(&t);
|
||||
*strchr(tim, '\n') = '\0';
|
||||
format_add(ft, "session_created_string", "%s", tim);
|
||||
@ -314,13 +314,13 @@ format_client(struct format_tree *ft, struct client *c)
|
||||
format_add(ft, "client_termname", "%s", c->tty.termname);
|
||||
|
||||
t = c->creation_time.tv_sec;
|
||||
format_add(ft, "client_created", "%ld", (long) t);
|
||||
format_add(ft, "client_created", "%lld", (long long) t);
|
||||
tim = ctime(&t);
|
||||
*strchr(tim, '\n') = '\0';
|
||||
format_add(ft, "client_created_string", "%s", tim);
|
||||
|
||||
t = c->activity_time.tv_sec;
|
||||
format_add(ft, "client_activity", "%ld", (long) t);
|
||||
format_add(ft, "client_activity", "%lld", (long long) t);
|
||||
tim = ctime(&t);
|
||||
*strchr(tim, '\n') = '\0';
|
||||
format_add(ft, "client_activity_string", "%s", tim);
|
||||
|
4
job.c
4
job.c
@ -143,8 +143,8 @@ job_write_callback(unused struct bufferevent *bufev, void *data)
|
||||
struct job *job = data;
|
||||
size_t len = EVBUFFER_LENGTH(EVBUFFER_OUTPUT(job->event));
|
||||
|
||||
log_debug("job write %p: %s, pid %ld, output left %lu", job, job->cmd,
|
||||
(long) job->pid, (unsigned long) len);
|
||||
log_debug("job write %p: %s, pid %ld, output left %zu", job, job->cmd,
|
||||
(long) job->pid, len);
|
||||
|
||||
if (len == 0) {
|
||||
shutdown(job->fd, SHUT_WR);
|
||||
|
@ -514,8 +514,10 @@ server_client_loop(void)
|
||||
|
||||
w->flags &= ~WINDOW_REDRAW;
|
||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||
server_client_check_focus(wp);
|
||||
server_client_check_resize(wp);
|
||||
if (wp->fd != -1) {
|
||||
server_client_check_focus(wp);
|
||||
server_client_check_resize(wp);
|
||||
}
|
||||
wp->flags &= ~PANE_REDRAW;
|
||||
}
|
||||
}
|
||||
@ -527,7 +529,7 @@ server_client_check_resize(struct window_pane *wp)
|
||||
{
|
||||
struct winsize ws;
|
||||
|
||||
if (wp->fd == -1 || !(wp->flags & PANE_RESIZE))
|
||||
if (!(wp->flags & PANE_RESIZE))
|
||||
return;
|
||||
|
||||
memset(&ws, 0, sizeof ws);
|
||||
|
@ -283,6 +283,7 @@ server_kill_window(struct window *w)
|
||||
if (options_get_number(&s->options, "renumber-windows"))
|
||||
session_renumber_windows(s);
|
||||
}
|
||||
recalculate_sizes();
|
||||
}
|
||||
|
||||
int
|
||||
|
8
server.c
8
server.c
@ -170,13 +170,13 @@ server_start(int lockfd, char *lockfile)
|
||||
cfg_references = 1;
|
||||
ARRAY_INIT(&cfg_causes);
|
||||
|
||||
if (access(SYSTEM_CFG, R_OK) == 0) {
|
||||
if (load_cfg(SYSTEM_CFG, cfg_cmd_q, &cause) == -1) {
|
||||
xasprintf(&cause, "%s: %s", SYSTEM_CFG, cause);
|
||||
if (access(TMUX_CONF, R_OK) == 0) {
|
||||
if (load_cfg(TMUX_CONF, cfg_cmd_q, &cause) == -1) {
|
||||
xasprintf(&cause, "%s: %s", TMUX_CONF, cause);
|
||||
ARRAY_ADD(&cfg_causes, cause);
|
||||
}
|
||||
} else if (errno != ENOENT) {
|
||||
xasprintf(&cause, "%s: %s", SYSTEM_CFG, strerror(errno));
|
||||
xasprintf(&cause, "%s: %s", TMUX_CONF, strerror(errno));
|
||||
ARRAY_ADD(&cfg_causes, cause);
|
||||
}
|
||||
if (cfg_file != NULL) {
|
||||
|
6
tmux.1
6
tmux.1
@ -122,7 +122,7 @@ Specify an alternative configuration file.
|
||||
By default,
|
||||
.Nm
|
||||
loads the system configuration file from
|
||||
.Pa /etc/tmux.conf ,
|
||||
.Pa @SYSCONFDIR@/tmux.conf ,
|
||||
if present, then looks for a user configuration file at
|
||||
.Pa ~/.tmux.conf .
|
||||
.Pp
|
||||
@ -3705,12 +3705,12 @@ was renamed to
|
||||
.Ar name .
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width "/etc/tmux.confXXX" -compact
|
||||
.Bl -tag -width "@SYSCONFDIR@/tmux.confXXX" -compact
|
||||
.It Pa ~/.tmux.conf
|
||||
Default
|
||||
.Nm
|
||||
configuration file.
|
||||
.It Pa /etc/tmux.conf
|
||||
.It Pa @SYSCONFDIR@/tmux.conf
|
||||
System-wide configuration file.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
|
2
tmux.c
2
tmux.c
@ -363,7 +363,7 @@ main(int argc, char **argv)
|
||||
if (pw != NULL)
|
||||
home = pw->pw_dir;
|
||||
}
|
||||
xasprintf(&cfg_file, "%s/%s", home, DEFAULT_CFG);
|
||||
xasprintf(&cfg_file, "%s/.tmux.conf", home);
|
||||
if (access(cfg_file, R_OK) != 0 && errno == ENOENT) {
|
||||
free(cfg_file);
|
||||
cfg_file = NULL;
|
||||
|
6
tmux.h
6
tmux.h
@ -39,10 +39,6 @@
|
||||
extern char *__progname;
|
||||
extern char **environ;
|
||||
|
||||
/* Default configuration files. */
|
||||
#define DEFAULT_CFG ".tmux.conf"
|
||||
#define SYSTEM_CFG "/etc/tmux.conf"
|
||||
|
||||
/* Default prompt history length. */
|
||||
#define PROMPT_HISTORY 100
|
||||
|
||||
@ -2253,6 +2249,8 @@ struct window_choose_data *window_choose_add_item(struct window_pane *,
|
||||
struct client *, struct winlink *, const char *,
|
||||
const char *, u_int);
|
||||
void window_choose_expand_all(struct window_pane *);
|
||||
void window_choose_collapse_all(struct window_pane *);
|
||||
void window_choose_set_current(struct window_pane *, u_int);
|
||||
|
||||
/* names.c */
|
||||
void queue_window_name(struct window *);
|
||||
|
@ -44,7 +44,6 @@ void window_choose_scroll_down(struct window_pane *);
|
||||
|
||||
void window_choose_collapse(struct window_pane *, struct session *);
|
||||
void window_choose_expand(struct window_pane *, struct session *, u_int);
|
||||
void window_choose_collapse_all(struct window_pane *);
|
||||
|
||||
enum window_choose_input_type {
|
||||
WINDOW_CHOOSE_NORMAL = -1,
|
||||
@ -102,8 +101,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
|
||||
}
|
||||
|
||||
void
|
||||
window_choose_ready(struct window_pane *wp, u_int cur,
|
||||
void (*callbackfn)(struct window_choose_data *))
|
||||
window_choose_set_current(struct window_pane *wp, u_int cur)
|
||||
{
|
||||
struct window_choose_mode_data *data = wp->modedata;
|
||||
struct screen *s = &data->screen;
|
||||
@ -112,12 +110,22 @@ window_choose_ready(struct window_pane *wp, u_int cur,
|
||||
if (data->selected > screen_size_y(s) - 1)
|
||||
data->top = ARRAY_LENGTH(&data->list) - screen_size_y(s);
|
||||
|
||||
window_choose_redraw_screen(wp);
|
||||
}
|
||||
|
||||
void
|
||||
window_choose_ready(struct window_pane *wp, u_int cur,
|
||||
void (*callbackfn)(struct window_choose_data *))
|
||||
{
|
||||
struct window_choose_mode_data *data = wp->modedata;
|
||||
|
||||
data->callbackfn = callbackfn;
|
||||
if (data->callbackfn == NULL)
|
||||
data->callbackfn = window_choose_default_callback;
|
||||
|
||||
ARRAY_CONCAT(&data->old_list, &data->list);
|
||||
|
||||
window_choose_set_current(wp, cur);
|
||||
window_choose_collapse_all(wp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user