mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Add infrastructure to work out the best target given a pane or window
alone and use it to add pane_died and pane_exited hooks.
This commit is contained in:
@ -293,12 +293,13 @@ server_unlink_window(struct session *s, struct winlink *wl)
|
||||
}
|
||||
|
||||
void
|
||||
server_destroy_pane(struct window_pane *wp)
|
||||
server_destroy_pane(struct window_pane *wp, int hooks)
|
||||
{
|
||||
struct window *w = wp->window;
|
||||
int old_fd;
|
||||
struct screen_write_ctx ctx;
|
||||
struct grid_cell gc;
|
||||
struct cmd_find_state fs;
|
||||
|
||||
old_fd = wp->fd;
|
||||
if (wp->fd != -1) {
|
||||
@ -319,6 +320,9 @@ server_destroy_pane(struct window_pane *wp)
|
||||
screen_write_puts(&ctx, &gc, "Pane is dead");
|
||||
screen_write_stop(&ctx);
|
||||
wp->flags |= PANE_REDRAW;
|
||||
|
||||
if (hooks && cmd_find_from_pane(&fs, wp) == 0)
|
||||
hooks_run(hooks_get(fs.s), NULL, &fs, "pane-died");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -326,6 +330,9 @@ server_destroy_pane(struct window_pane *wp)
|
||||
layout_close_pane(wp);
|
||||
window_remove_pane(w, wp);
|
||||
|
||||
if (hooks && cmd_find_from_window(&fs, w) == 0)
|
||||
hooks_run(hooks_get(fs.s), NULL, &fs, "pane-exited");
|
||||
|
||||
if (TAILQ_EMPTY(&w->panes))
|
||||
server_kill_window(w);
|
||||
else
|
||||
|
Reference in New Issue
Block a user