mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 09:28:51 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
6b83ca0077
@ -266,7 +266,7 @@ mode_tree_count_tagged(struct mode_tree_data *mtd)
|
||||
|
||||
void
|
||||
mode_tree_each_tagged(struct mode_tree_data *mtd, void (*cb)(void *, void *,
|
||||
key_code), key_code key, int current)
|
||||
struct client *, key_code), struct client *c, key_code key, int current)
|
||||
{
|
||||
struct mode_tree_item *mti;
|
||||
u_int i;
|
||||
@ -277,12 +277,12 @@ mode_tree_each_tagged(struct mode_tree_data *mtd, void (*cb)(void *, void *,
|
||||
mti = mtd->line_list[i].item;
|
||||
if (mti->tagged) {
|
||||
fired = 1;
|
||||
cb(mtd->modedata, mti->itemdata, key);
|
||||
cb(mtd->modedata, mti->itemdata, c, key);
|
||||
}
|
||||
}
|
||||
if (!fired && current) {
|
||||
mti = mtd->line_list[mtd->current].item;
|
||||
cb(mtd->modedata, mti->itemdata, key);
|
||||
cb(mtd->modedata, mti->itemdata, c, key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -848,6 +848,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
|
||||
mode_tree_build(mtd);
|
||||
break;
|
||||
case KEYC_LEFT:
|
||||
case 'h':
|
||||
case '-':
|
||||
if (line->flat || !current->expanded)
|
||||
current = current->parent;
|
||||
@ -860,6 +861,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
|
||||
}
|
||||
break;
|
||||
case KEYC_RIGHT:
|
||||
case 'l':
|
||||
case '+':
|
||||
if (line->flat || current->expanded)
|
||||
mode_tree_down(mtd, 0);
|
||||
|
4
tmux.1
4
tmux.1
@ -4104,7 +4104,7 @@ a list.
|
||||
The following keys may be used in buffer mode:
|
||||
.Bl -column "Key" "Function" -offset indent
|
||||
.It Sy "Key" Ta Sy "Function"
|
||||
.It Li "Enter" Ta "Choose selected buffer"
|
||||
.It Li "Enter" Ta "Paste selected buffer"
|
||||
.It Li "Up" Ta "Select previous buffer"
|
||||
.It Li "Down" Ta "Select next buffer"
|
||||
.It Li "C-s" Ta "Search by name or content"
|
||||
@ -4112,6 +4112,8 @@ The following keys may be used in buffer mode:
|
||||
.It Li "t" Ta "Toggle if buffer is tagged"
|
||||
.It Li "T" Ta "Tag no buffers"
|
||||
.It Li "C-t" Ta "Tag all buffers"
|
||||
.It Li "p" Ta "Paste selected buffer"
|
||||
.It Li "P" Ta "Paste tagged buffers"
|
||||
.It Li "d" Ta "Delete selected buffer"
|
||||
.It Li "D" Ta "Delete tagged buffers"
|
||||
.It Li "f" Ta "Enter a format to filter items"
|
||||
|
2
tmux.h
2
tmux.h
@ -2230,7 +2230,7 @@ u_int layout_set_previous(struct window *);
|
||||
u_int mode_tree_count_tagged(struct mode_tree_data *);
|
||||
void *mode_tree_get_current(struct mode_tree_data *);
|
||||
void mode_tree_each_tagged(struct mode_tree_data *, void (*)(void *, void *,
|
||||
key_code), key_code, int);
|
||||
struct client *, key_code), struct client *, key_code, int);
|
||||
void mode_tree_up(struct mode_tree_data *, int);
|
||||
void mode_tree_down(struct mode_tree_data *, int);
|
||||
struct mode_tree_data *mode_tree_start(struct window_pane *, struct args *,
|
||||
|
@ -318,7 +318,8 @@ window_buffer_resize(struct window_pane *wp, u_int sx, u_int sy)
|
||||
}
|
||||
|
||||
static void
|
||||
window_buffer_do_delete(void* modedata, void *itemdata, __unused key_code key)
|
||||
window_buffer_do_delete(void* modedata, void *itemdata,
|
||||
__unused struct client *c, __unused key_code key)
|
||||
{
|
||||
struct window_buffer_modedata *data = modedata;
|
||||
struct window_buffer_itemdata *item = itemdata;
|
||||
@ -330,53 +331,53 @@ window_buffer_do_delete(void* modedata, void *itemdata, __unused key_code key)
|
||||
paste_free(pb);
|
||||
}
|
||||
|
||||
static void
|
||||
window_buffer_do_paste(void* modedata, void *itemdata, struct client *c,
|
||||
__unused key_code key)
|
||||
{
|
||||
struct window_buffer_modedata *data = modedata;
|
||||
struct window_buffer_itemdata *item = itemdata;
|
||||
struct paste_buffer *pb;
|
||||
|
||||
if ((pb = paste_get_name(item->name)) != NULL)
|
||||
mode_tree_run_command(c, NULL, data->command, item->name);
|
||||
}
|
||||
|
||||
static void
|
||||
window_buffer_key(struct window_pane *wp, struct client *c,
|
||||
__unused struct session *s, key_code key, struct mouse_event *m)
|
||||
{
|
||||
struct window_buffer_modedata *data = wp->modedata;
|
||||
struct mode_tree_data *mtd = data->data;
|
||||
struct window_buffer_itemdata *item;
|
||||
char *command, *name;
|
||||
int finished;
|
||||
|
||||
/*
|
||||
* t = toggle tag
|
||||
* T = tag none
|
||||
* C-t = tag all
|
||||
* q = exit
|
||||
* O = change sort order
|
||||
*
|
||||
* d = delete buffer
|
||||
* D = delete tagged buffers
|
||||
* Enter = paste buffer
|
||||
*/
|
||||
|
||||
finished = mode_tree_key(data->data, c, &key, m);
|
||||
finished = mode_tree_key(mtd, c, &key, m);
|
||||
switch (key) {
|
||||
case 'd':
|
||||
item = mode_tree_get_current(data->data);
|
||||
window_buffer_do_delete(data, item, key);
|
||||
mode_tree_build(data->data);
|
||||
item = mode_tree_get_current(mtd);
|
||||
window_buffer_do_delete(data, item, c, key);
|
||||
mode_tree_build(mtd);
|
||||
break;
|
||||
case 'D':
|
||||
mode_tree_each_tagged(data->data, window_buffer_do_delete, key,
|
||||
0);
|
||||
mode_tree_build(data->data);
|
||||
mode_tree_each_tagged(mtd, window_buffer_do_delete, c, key, 0);
|
||||
mode_tree_build(mtd);
|
||||
break;
|
||||
case 'P':
|
||||
mode_tree_each_tagged(mtd, window_buffer_do_paste, c, key, 0);
|
||||
finished = 1;
|
||||
break;
|
||||
case 'p':
|
||||
case '\r':
|
||||
item = mode_tree_get_current(data->data);
|
||||
command = xstrdup(data->command);
|
||||
name = xstrdup(item->name);
|
||||
window_pane_reset_mode(wp);
|
||||
mode_tree_run_command(c, NULL, command, name);
|
||||
free(name);
|
||||
free(command);
|
||||
return;
|
||||
item = mode_tree_get_current(mtd);
|
||||
window_buffer_do_paste(data, item, c, key);
|
||||
finished = 1;
|
||||
break;
|
||||
}
|
||||
if (finished || paste_get_top(NULL) == NULL)
|
||||
window_pane_reset_mode(wp);
|
||||
else {
|
||||
mode_tree_draw(data->data);
|
||||
mode_tree_draw(mtd);
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +301,8 @@ window_client_resize(struct window_pane *wp, u_int sx, u_int sy)
|
||||
}
|
||||
|
||||
static void
|
||||
window_client_do_detach(void* modedata, void *itemdata, key_code key)
|
||||
window_client_do_detach(void* modedata, void *itemdata,
|
||||
__unused struct client *c, key_code key)
|
||||
{
|
||||
struct window_client_modedata *data = modedata;
|
||||
struct window_client_itemdata *item = itemdata;
|
||||
@ -321,56 +322,35 @@ window_client_key(struct window_pane *wp, struct client *c,
|
||||
__unused struct session *s, key_code key, struct mouse_event *m)
|
||||
{
|
||||
struct window_client_modedata *data = wp->modedata;
|
||||
struct mode_tree_data *mtd = data->data;
|
||||
struct window_client_itemdata *item;
|
||||
char *command, *name;
|
||||
int finished;
|
||||
|
||||
/*
|
||||
* t = toggle tag
|
||||
* T = tag none
|
||||
* C-t = tag all
|
||||
* q = exit
|
||||
* O = change sort order
|
||||
*
|
||||
* d = detach client
|
||||
* D = detach tagged clients
|
||||
* x = detach and kill client
|
||||
* X = detach and kill tagged clients
|
||||
* z = suspend client
|
||||
* Z = suspend tagged clients
|
||||
* Enter = detach client
|
||||
*/
|
||||
|
||||
finished = mode_tree_key(data->data, c, &key, m);
|
||||
finished = mode_tree_key(mtd, c, &key, m);
|
||||
switch (key) {
|
||||
case 'd':
|
||||
case 'x':
|
||||
case 'z':
|
||||
item = mode_tree_get_current(data->data);
|
||||
window_client_do_detach(data, item, key);
|
||||
mode_tree_build(data->data);
|
||||
item = mode_tree_get_current(mtd);
|
||||
window_client_do_detach(data, item, c, key);
|
||||
mode_tree_build(mtd);
|
||||
break;
|
||||
case 'D':
|
||||
case 'X':
|
||||
case 'Z':
|
||||
mode_tree_each_tagged(data->data, window_client_do_detach, key,
|
||||
0);
|
||||
mode_tree_build(data->data);
|
||||
mode_tree_each_tagged(mtd, window_client_do_detach, c, key, 0);
|
||||
mode_tree_build(mtd);
|
||||
break;
|
||||
case '\r':
|
||||
item = mode_tree_get_current(data->data);
|
||||
command = xstrdup(data->command);
|
||||
name = xstrdup(item->c->ttyname);
|
||||
window_pane_reset_mode(wp);
|
||||
mode_tree_run_command(c, NULL, command, name);
|
||||
free(name);
|
||||
free(command);
|
||||
return;
|
||||
item = mode_tree_get_current(mtd);
|
||||
mode_tree_run_command(c, NULL, data->command, item->c->ttyname);
|
||||
finished = 1;
|
||||
break;
|
||||
}
|
||||
if (finished || server_client_how_many() == 0)
|
||||
window_pane_reset_mode(wp);
|
||||
else {
|
||||
mode_tree_draw(data->data);
|
||||
mode_tree_draw(mtd);
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,6 @@ struct window_tree_modedata {
|
||||
struct window_tree_itemdata **item_list;
|
||||
u_int item_size;
|
||||
|
||||
struct client *client;
|
||||
const char *entered;
|
||||
|
||||
struct cmd_find_state fs;
|
||||
@ -898,7 +897,8 @@ window_tree_get_target(struct window_tree_itemdata *item,
|
||||
}
|
||||
|
||||
static void
|
||||
window_tree_command_each(void* modedata, void* itemdata, __unused key_code key)
|
||||
window_tree_command_each(void* modedata, void* itemdata, struct client *c,
|
||||
__unused key_code key)
|
||||
{
|
||||
struct window_tree_modedata *data = modedata;
|
||||
struct window_tree_itemdata *item = itemdata;
|
||||
@ -907,7 +907,7 @@ window_tree_command_each(void* modedata, void* itemdata, __unused key_code key)
|
||||
|
||||
name = window_tree_get_target(item, &fs);
|
||||
if (name != NULL)
|
||||
mode_tree_run_command(data->client, &fs, data->entered, name);
|
||||
mode_tree_run_command(c, &fs, data->entered, name);
|
||||
free(name);
|
||||
}
|
||||
|
||||
@ -934,13 +934,9 @@ window_tree_command_callback(struct client *c, void *modedata, const char *s,
|
||||
if (data->dead)
|
||||
return (0);
|
||||
|
||||
data->client = c;
|
||||
data->entered = s;
|
||||
|
||||
mode_tree_each_tagged(data->data, window_tree_command_each, KEYC_NONE,
|
||||
1);
|
||||
|
||||
data->client = NULL;
|
||||
mode_tree_each_tagged(data->data, window_tree_command_each, c,
|
||||
KEYC_NONE, 1);
|
||||
data->entered = NULL;
|
||||
|
||||
data->references++;
|
||||
@ -963,7 +959,7 @@ window_tree_key(struct window_pane *wp, struct client *c,
|
||||
{
|
||||
struct window_tree_modedata *data = wp->modedata;
|
||||
struct window_tree_itemdata *item;
|
||||
char *command, *name, *prompt;
|
||||
char *name, *prompt;
|
||||
struct cmd_find_state fs;
|
||||
int finished;
|
||||
u_int tagged;
|
||||
@ -992,14 +988,12 @@ window_tree_key(struct window_pane *wp, struct client *c,
|
||||
break;
|
||||
case '\r':
|
||||
item = mode_tree_get_current(data->data);
|
||||
command = xstrdup(data->command);
|
||||
name = window_tree_get_target(item, &fs);
|
||||
window_pane_reset_mode(wp);
|
||||
if (name != NULL)
|
||||
mode_tree_run_command(c, NULL, command, name);
|
||||
mode_tree_run_command(c, NULL, data->command, name);
|
||||
finished = 1;
|
||||
free(name);
|
||||
free(command);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (finished)
|
||||
window_pane_reset_mode(wp);
|
||||
|
Loading…
Reference in New Issue
Block a user