mirror of
https://github.com/tmux/tmux.git
synced 2024-11-05 02:18:47 +00:00
Sync OpenBSD patchset 1098:
Use a helper function to fire choose callback.
This commit is contained in:
parent
6df8953f4f
commit
c8c6a23d66
@ -29,6 +29,7 @@ void window_choose_key(struct window_pane *, struct session *, int);
|
|||||||
void window_choose_mouse(
|
void window_choose_mouse(
|
||||||
struct window_pane *, struct session *, struct mouse_event *);
|
struct window_pane *, struct session *, struct mouse_event *);
|
||||||
|
|
||||||
|
void window_choose_fire_callback(struct window_pane *, int);
|
||||||
void window_choose_redraw_screen(struct window_pane *);
|
void window_choose_redraw_screen(struct window_pane *);
|
||||||
void window_choose_write_line(
|
void window_choose_write_line(
|
||||||
struct window_pane *, struct screen_write_ctx *, u_int);
|
struct window_pane *, struct screen_write_ctx *, u_int);
|
||||||
@ -169,6 +170,20 @@ window_choose_resize(struct window_pane *wp, u_int sx, u_int sy)
|
|||||||
window_choose_redraw_screen(wp);
|
window_choose_redraw_screen(wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
window_choose_fire_callback(struct window_pane *wp, int idx)
|
||||||
|
{
|
||||||
|
struct window_choose_mode_data *data = wp->modedata;
|
||||||
|
const struct window_mode *oldmode;
|
||||||
|
|
||||||
|
oldmode = wp->mode;
|
||||||
|
wp->mode = NULL;
|
||||||
|
|
||||||
|
data->callbackfn(data->data, idx);
|
||||||
|
|
||||||
|
wp->mode = oldmode;
|
||||||
|
}
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
void
|
void
|
||||||
window_choose_key(struct window_pane *wp, unused struct session *sess, int key)
|
window_choose_key(struct window_pane *wp, unused struct session *sess, int key)
|
||||||
@ -184,12 +199,12 @@ window_choose_key(struct window_pane *wp, unused struct session *sess, int key)
|
|||||||
|
|
||||||
switch (mode_key_lookup(&data->mdata, key)) {
|
switch (mode_key_lookup(&data->mdata, key)) {
|
||||||
case MODEKEYCHOICE_CANCEL:
|
case MODEKEYCHOICE_CANCEL:
|
||||||
data->callbackfn(data->data, -1);
|
window_choose_fire_callback(wp, -1);
|
||||||
window_pane_reset_mode(wp);
|
window_pane_reset_mode(wp);
|
||||||
break;
|
break;
|
||||||
case MODEKEYCHOICE_CHOOSE:
|
case MODEKEYCHOICE_CHOOSE:
|
||||||
item = &ARRAY_ITEM(&data->list, data->selected);
|
item = &ARRAY_ITEM(&data->list, data->selected);
|
||||||
data->callbackfn(data->data, item->idx);
|
window_choose_fire_callback(wp, item->idx);
|
||||||
window_pane_reset_mode(wp);
|
window_pane_reset_mode(wp);
|
||||||
break;
|
break;
|
||||||
case MODEKEYCHOICE_UP:
|
case MODEKEYCHOICE_UP:
|
||||||
@ -295,7 +310,7 @@ window_choose_key(struct window_pane *wp, unused struct session *sess, int key)
|
|||||||
data->selected = idx;
|
data->selected = idx;
|
||||||
|
|
||||||
item = &ARRAY_ITEM(&data->list, data->selected);
|
item = &ARRAY_ITEM(&data->list, data->selected);
|
||||||
data->callbackfn(data->data, item->idx);
|
window_choose_fire_callback(wp, item->idx);
|
||||||
window_pane_reset_mode(wp);
|
window_pane_reset_mode(wp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -324,7 +339,7 @@ window_choose_mouse(
|
|||||||
data->selected = idx;
|
data->selected = idx;
|
||||||
|
|
||||||
item = &ARRAY_ITEM(&data->list, data->selected);
|
item = &ARRAY_ITEM(&data->list, data->selected);
|
||||||
data->callbackfn(data->data, item->idx);
|
window_choose_fire_callback(wp, item->idx);
|
||||||
window_pane_reset_mode(wp);
|
window_pane_reset_mode(wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user