mirror of
https://github.com/tmux/tmux.git
synced 2025-01-14 20:58:53 +00:00
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
This commit is contained in:
commit
ce52e45d44
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)
|
if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1)
|
||||||
fatal("open failed");
|
fatal("open failed");
|
||||||
|
|
||||||
if (flock(lockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) {
|
if (lockf(lockfd, F_TLOCK, 0) == -1 && errno == EAGAIN) {
|
||||||
while (flock(lockfd, LOCK_EX) == -1 && errno == EINTR)
|
while (lockf(lockfd, F_LOCK, 0) == -1 && errno == EINTR)
|
||||||
/* nothing */;
|
/* nothing */;
|
||||||
close(lockfd);
|
close(lockfd);
|
||||||
return (-1);
|
return (-1);
|
||||||
|
@ -89,10 +89,7 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((s = c->session) == NULL)
|
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), &s)) == NULL)
|
||||||
return (CMD_RETURN_ERROR);
|
|
||||||
|
|
||||||
if ((wl = cmd_find_window(cmdq, args_get(args, 't'), NULL)) == NULL)
|
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
|
|
||||||
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
|
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
|
||||||
@ -231,9 +228,12 @@ windows_only:
|
|||||||
free(final_win_template_last);
|
free(final_win_template_last);
|
||||||
|
|
||||||
window_choose_ready(wl->window->active, cur_win, NULL);
|
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_expand_all(wl->window->active);
|
||||||
|
window_choose_set_current(wl->window->active, cur_win);
|
||||||
|
}
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
}
|
}
|
||||||
|
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));
|
format_add(ft, "session_group", "%u", session_group_index(sg));
|
||||||
|
|
||||||
t = s->creation_time.tv_sec;
|
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);
|
tim = ctime(&t);
|
||||||
*strchr(tim, '\n') = '\0';
|
*strchr(tim, '\n') = '\0';
|
||||||
format_add(ft, "session_created_string", "%s", tim);
|
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);
|
format_add(ft, "client_termname", "%s", c->tty.termname);
|
||||||
|
|
||||||
t = c->creation_time.tv_sec;
|
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);
|
tim = ctime(&t);
|
||||||
*strchr(tim, '\n') = '\0';
|
*strchr(tim, '\n') = '\0';
|
||||||
format_add(ft, "client_created_string", "%s", tim);
|
format_add(ft, "client_created_string", "%s", tim);
|
||||||
|
|
||||||
t = c->activity_time.tv_sec;
|
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);
|
tim = ctime(&t);
|
||||||
*strchr(tim, '\n') = '\0';
|
*strchr(tim, '\n') = '\0';
|
||||||
format_add(ft, "client_activity_string", "%s", tim);
|
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;
|
struct job *job = data;
|
||||||
size_t len = EVBUFFER_LENGTH(EVBUFFER_OUTPUT(job->event));
|
size_t len = EVBUFFER_LENGTH(EVBUFFER_OUTPUT(job->event));
|
||||||
|
|
||||||
log_debug("job write %p: %s, pid %ld, output left %lu", job, job->cmd,
|
log_debug("job write %p: %s, pid %ld, output left %zu", job, job->cmd,
|
||||||
(long) job->pid, (unsigned long) len);
|
(long) job->pid, len);
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
shutdown(job->fd, SHUT_WR);
|
shutdown(job->fd, SHUT_WR);
|
||||||
|
@ -514,8 +514,10 @@ server_client_loop(void)
|
|||||||
|
|
||||||
w->flags &= ~WINDOW_REDRAW;
|
w->flags &= ~WINDOW_REDRAW;
|
||||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||||
|
if (wp->fd != -1) {
|
||||||
server_client_check_focus(wp);
|
server_client_check_focus(wp);
|
||||||
server_client_check_resize(wp);
|
server_client_check_resize(wp);
|
||||||
|
}
|
||||||
wp->flags &= ~PANE_REDRAW;
|
wp->flags &= ~PANE_REDRAW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -527,7 +529,7 @@ server_client_check_resize(struct window_pane *wp)
|
|||||||
{
|
{
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
|
|
||||||
if (wp->fd == -1 || !(wp->flags & PANE_RESIZE))
|
if (!(wp->flags & PANE_RESIZE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(&ws, 0, sizeof ws);
|
memset(&ws, 0, sizeof ws);
|
||||||
|
@ -283,6 +283,7 @@ server_kill_window(struct window *w)
|
|||||||
if (options_get_number(&s->options, "renumber-windows"))
|
if (options_get_number(&s->options, "renumber-windows"))
|
||||||
session_renumber_windows(s);
|
session_renumber_windows(s);
|
||||||
}
|
}
|
||||||
|
recalculate_sizes();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
2
tmux.h
2
tmux.h
@ -2249,6 +2249,8 @@ struct window_choose_data *window_choose_add_item(struct window_pane *,
|
|||||||
struct client *, struct winlink *, const char *,
|
struct client *, struct winlink *, const char *,
|
||||||
const char *, u_int);
|
const char *, u_int);
|
||||||
void window_choose_expand_all(struct window_pane *);
|
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 */
|
/* names.c */
|
||||||
void queue_window_name(struct window *);
|
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_collapse(struct window_pane *, struct session *);
|
||||||
void window_choose_expand(struct window_pane *, struct session *, u_int);
|
void window_choose_expand(struct window_pane *, struct session *, u_int);
|
||||||
void window_choose_collapse_all(struct window_pane *);
|
|
||||||
|
|
||||||
enum window_choose_input_type {
|
enum window_choose_input_type {
|
||||||
WINDOW_CHOOSE_NORMAL = -1,
|
WINDOW_CHOOSE_NORMAL = -1,
|
||||||
@ -102,8 +101,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
window_choose_ready(struct window_pane *wp, u_int cur,
|
window_choose_set_current(struct window_pane *wp, u_int cur)
|
||||||
void (*callbackfn)(struct window_choose_data *))
|
|
||||||
{
|
{
|
||||||
struct window_choose_mode_data *data = wp->modedata;
|
struct window_choose_mode_data *data = wp->modedata;
|
||||||
struct screen *s = &data->screen;
|
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)
|
if (data->selected > screen_size_y(s) - 1)
|
||||||
data->top = ARRAY_LENGTH(&data->list) - screen_size_y(s);
|
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;
|
data->callbackfn = callbackfn;
|
||||||
if (data->callbackfn == NULL)
|
if (data->callbackfn == NULL)
|
||||||
data->callbackfn = window_choose_default_callback;
|
data->callbackfn = window_choose_default_callback;
|
||||||
|
|
||||||
ARRAY_CONCAT(&data->old_list, &data->list);
|
ARRAY_CONCAT(&data->old_list, &data->list);
|
||||||
|
|
||||||
|
window_choose_set_current(wp, cur);
|
||||||
window_choose_collapse_all(wp);
|
window_choose_collapse_all(wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user