mirror of
https://github.com/tmux/tmux.git
synced 2024-10-31 22:58:49 +00:00
Add paste-buffer-deleted notification and fix name of paste-buffer-changed.
This commit is contained in:
parent
c2580cfe24
commit
8edece2cdb
@ -244,6 +244,19 @@ control_notify_paste_buffer_changed(const char *name)
|
|||||||
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c))
|
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
control_write(c, "%%paste-changed %s", name);
|
control_write(c, "%%paste-buffer-changed %s", name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
control_notify_paste_buffer_deleted(const char *name)
|
||||||
|
{
|
||||||
|
struct client *c;
|
||||||
|
|
||||||
|
TAILQ_FOREACH(c, &clients, entry) {
|
||||||
|
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
control_write(c, "%%paste-buffer-deleted %s", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
input.c
11
input.c
@ -1755,7 +1755,6 @@ static void
|
|||||||
input_csi_dispatch_sm_private(struct input_ctx *ictx)
|
input_csi_dispatch_sm_private(struct input_ctx *ictx)
|
||||||
{
|
{
|
||||||
struct screen_write_ctx *sctx = &ictx->ctx;
|
struct screen_write_ctx *sctx = &ictx->ctx;
|
||||||
struct window_pane *wp = ictx->wp;
|
|
||||||
struct grid_cell *gc = &ictx->cell.cell;
|
struct grid_cell *gc = &ictx->cell.cell;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
@ -1797,17 +1796,7 @@ input_csi_dispatch_sm_private(struct input_ctx *ictx)
|
|||||||
screen_write_mode_set(sctx, MODE_MOUSE_ALL);
|
screen_write_mode_set(sctx, MODE_MOUSE_ALL);
|
||||||
break;
|
break;
|
||||||
case 1004:
|
case 1004:
|
||||||
if (sctx->s->mode & MODE_FOCUSON)
|
|
||||||
break;
|
|
||||||
screen_write_mode_set(sctx, MODE_FOCUSON);
|
screen_write_mode_set(sctx, MODE_FOCUSON);
|
||||||
if (wp == NULL)
|
|
||||||
break;
|
|
||||||
if (!options_get_number(global_options, "focus-events"))
|
|
||||||
break;
|
|
||||||
if (wp->flags & PANE_FOCUSED)
|
|
||||||
bufferevent_write(wp->event, "\033[I", 3);
|
|
||||||
else
|
|
||||||
bufferevent_write(wp->event, "\033[O", 3);
|
|
||||||
break;
|
break;
|
||||||
case 1005:
|
case 1005:
|
||||||
screen_write_mode_set(sctx, MODE_MOUSE_UTF8);
|
screen_write_mode_set(sctx, MODE_MOUSE_UTF8);
|
||||||
|
12
notify.c
12
notify.c
@ -153,6 +153,8 @@ notify_callback(struct cmdq_item *item, void *data)
|
|||||||
control_notify_session_window_changed(ne->session);
|
control_notify_session_window_changed(ne->session);
|
||||||
if (strcmp(ne->name, "paste-buffer-changed") == 0)
|
if (strcmp(ne->name, "paste-buffer-changed") == 0)
|
||||||
control_notify_paste_buffer_changed(ne->pbname);
|
control_notify_paste_buffer_changed(ne->pbname);
|
||||||
|
if (strcmp(ne->name, "paste-buffer-deleted") == 0)
|
||||||
|
control_notify_paste_buffer_deleted(ne->pbname);
|
||||||
|
|
||||||
notify_insert_hook(item, ne);
|
notify_insert_hook(item, ne);
|
||||||
|
|
||||||
@ -307,10 +309,16 @@ notify_pane(const char *name, struct window_pane *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_paste_buffer(const char *pbname)
|
notify_paste_buffer(const char *pbname, int deleted)
|
||||||
{
|
{
|
||||||
struct cmd_find_state fs;
|
struct cmd_find_state fs;
|
||||||
|
|
||||||
cmd_find_clear_state(&fs, 0);
|
cmd_find_clear_state(&fs, 0);
|
||||||
notify_add("paste-buffer-changed", &fs, NULL, NULL, NULL, NULL, pbname);
|
if (deleted) {
|
||||||
|
notify_add("paste-buffer-deleted", &fs, NULL, NULL, NULL, NULL,
|
||||||
|
pbname);
|
||||||
|
} else {
|
||||||
|
notify_add("paste-buffer-changed", &fs, NULL, NULL, NULL, NULL,
|
||||||
|
pbname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
12
paste.c
12
paste.c
@ -151,7 +151,7 @@ paste_get_name(const char *name)
|
|||||||
void
|
void
|
||||||
paste_free(struct paste_buffer *pb)
|
paste_free(struct paste_buffer *pb)
|
||||||
{
|
{
|
||||||
notify_paste_buffer(pb->name);
|
notify_paste_buffer(pb->name, 1);
|
||||||
|
|
||||||
RB_REMOVE(paste_name_tree, &paste_by_name, pb);
|
RB_REMOVE(paste_name_tree, &paste_by_name, pb);
|
||||||
RB_REMOVE(paste_time_tree, &paste_by_time, pb);
|
RB_REMOVE(paste_time_tree, &paste_by_time, pb);
|
||||||
@ -210,7 +210,7 @@ paste_add(const char *prefix, char *data, size_t size)
|
|||||||
RB_INSERT(paste_name_tree, &paste_by_name, pb);
|
RB_INSERT(paste_name_tree, &paste_by_name, pb);
|
||||||
RB_INSERT(paste_time_tree, &paste_by_time, pb);
|
RB_INSERT(paste_time_tree, &paste_by_time, pb);
|
||||||
|
|
||||||
notify_paste_buffer(pb->name);
|
notify_paste_buffer(pb->name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rename a paste buffer. */
|
/* Rename a paste buffer. */
|
||||||
@ -258,8 +258,8 @@ paste_rename(const char *oldname, const char *newname, char **cause)
|
|||||||
|
|
||||||
RB_INSERT(paste_name_tree, &paste_by_name, pb);
|
RB_INSERT(paste_name_tree, &paste_by_name, pb);
|
||||||
|
|
||||||
notify_paste_buffer(oldname);
|
notify_paste_buffer(oldname, 1);
|
||||||
notify_paste_buffer(newname);
|
notify_paste_buffer(newname, 0);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ paste_set(char *data, size_t size, const char *name, char **cause)
|
|||||||
RB_INSERT(paste_name_tree, &paste_by_name, pb);
|
RB_INSERT(paste_name_tree, &paste_by_name, pb);
|
||||||
RB_INSERT(paste_time_tree, &paste_by_time, pb);
|
RB_INSERT(paste_time_tree, &paste_by_time, pb);
|
||||||
|
|
||||||
notify_paste_buffer(name);
|
notify_paste_buffer(name, 0);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ paste_replace(struct paste_buffer *pb, char *data, size_t size)
|
|||||||
pb->data = data;
|
pb->data = data;
|
||||||
pb->size = size;
|
pb->size = size;
|
||||||
|
|
||||||
notify_paste_buffer(pb->name);
|
notify_paste_buffer(pb->name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert start of buffer into a nice string. */
|
/* Convert start of buffer into a nice string. */
|
||||||
|
4
tmux.1
4
tmux.1
@ -6612,6 +6612,10 @@ has changed mode.
|
|||||||
Paste buffer
|
Paste buffer
|
||||||
.Ar name
|
.Ar name
|
||||||
has been changed.
|
has been changed.
|
||||||
|
.It Ic %paste-buffer-deleted Ar name
|
||||||
|
Paste buffer
|
||||||
|
.Ar name
|
||||||
|
has been deleted.
|
||||||
.It Ic %pause Ar pane-id
|
.It Ic %pause Ar pane-id
|
||||||
The pane has been paused (if the
|
The pane has been paused (if the
|
||||||
.Ar pause-after
|
.Ar pause-after
|
||||||
|
3
tmux.h
3
tmux.h
@ -2163,7 +2163,7 @@ void notify_winlink(const char *, struct winlink *);
|
|||||||
void notify_session_window(const char *, struct session *, struct window *);
|
void notify_session_window(const char *, struct session *, struct window *);
|
||||||
void notify_window(const char *, struct window *);
|
void notify_window(const char *, struct window *);
|
||||||
void notify_pane(const char *, struct window_pane *);
|
void notify_pane(const char *, struct window_pane *);
|
||||||
void notify_paste_buffer(const char *);
|
void notify_paste_buffer(const char *, int);
|
||||||
|
|
||||||
/* options.c */
|
/* options.c */
|
||||||
struct options *options_create(struct options *);
|
struct options *options_create(struct options *);
|
||||||
@ -3185,6 +3185,7 @@ void control_notify_session_created(struct session *);
|
|||||||
void control_notify_session_closed(struct session *);
|
void control_notify_session_closed(struct session *);
|
||||||
void control_notify_session_window_changed(struct session *);
|
void control_notify_session_window_changed(struct session *);
|
||||||
void control_notify_paste_buffer_changed(const char *);
|
void control_notify_paste_buffer_changed(const char *);
|
||||||
|
void control_notify_paste_buffer_deleted(const char *);
|
||||||
|
|
||||||
/* session.c */
|
/* session.c */
|
||||||
extern struct sessions sessions;
|
extern struct sessions sessions;
|
||||||
|
Loading…
Reference in New Issue
Block a user