summaryrefslogtreecommitdiffstats
path: root/src/popupwin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/popupwin.c')
-rw-r--r--src/popupwin.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 38c1c9e..0ff57fb 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -699,8 +699,8 @@ popup_highlight_curline(win_T *wp)
if (syn_name2id((char_u *)linehl) == 0)
linehl = "PmenuSel";
- sign_define_by_name(sign_name, NULL, (char_u *)linehl,
- NULL, NULL, NULL, NULL);
+ sign_define_by_name(sign_name, NULL, (char_u *)linehl, NULL, NULL, NULL,
+ NULL, SIGN_DEF_PRIO);
}
sign_place(&sign_id, (char_u *)"PopUpMenu", sign_name,
@@ -2651,6 +2651,8 @@ f_popup_filter_yesno(typval_T *argvars, typval_T *rettv)
return;
c = *key;
+ if (c == CAR && need_wait_return)
+ return;
if (c == K_SPECIAL && key[1] != NUL)
c = TO_SPECIAL(key[1], key[2]);
@@ -2844,6 +2846,54 @@ f_popup_settext(typval_T *argvars, typval_T *rettv UNUSED)
popup_adjust_position(wp);
}
+/*
+ * popup_setbuf({id}, {bufnr})
+ */
+ void
+f_popup_setbuf(typval_T *argvars, typval_T *rettv UNUSED)
+{
+ int id;
+ win_T *wp;
+ buf_T *buf;
+
+ rettv->v_type = VAR_BOOL;
+ rettv->vval.v_number = VVAL_FALSE;
+
+ if (check_for_number_arg(argvars, 0) == FAIL
+ || check_for_buffer_arg(argvars, 1) == FAIL)
+ return;
+
+ id = (int)tv_get_number(&argvars[0]);
+ wp = find_popup_win(id);
+ if (wp == NULL)
+ return;
+
+ buf = tv_get_buf_from_arg(&argvars[1]);
+
+ if (buf == NULL)
+ return;
+#ifdef FEAT_TERMINAL
+ if (buf->b_term != NULL && popup_terminal_exists())
+ {
+ emsg(_(e_cannot_open_second_popup_with_terminal));
+ return;
+ }
+#endif
+
+ if (wp->w_buffer != buf)
+ {
+ wp->w_buffer->b_nwindows--;
+ win_init_popup_win(wp, buf);
+ set_local_options_default(wp, FALSE);
+ swap_exists_action = SEA_READONLY;
+ buffer_ensure_loaded(buf);
+ swap_exists_action = SEA_NONE;
+ redraw_win_later(wp, UPD_NOT_VALID);
+ popup_adjust_position(wp);
+ }
+ rettv->vval.v_number = VVAL_TRUE;
+}
+
static void
popup_free(win_T *wp)
{