diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-14 14:32:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-14 14:32:22 +0100 |
commit | 00f3b4e007af07870168bf044cecc9d544483953 (patch) | |
tree | debd23a51f44608cb926dd1616babd1934be10b5 /src/evalwindow.c | |
parent | 0a8fed6231c84e4e1b3a7dd6c0d95d3f98207fe0 (diff) | |
download | vim-git-00f3b4e007af07870168bf044cecc9d544483953.tar.gz |
patch 8.2.0257: cannot recognize a terminal in a popup windowv8.2.0257
Problem: Cannot recognize a terminal in a popup window.
Solution: Add the win_gettype() function.
Diffstat (limited to 'src/evalwindow.c')
-rw-r--r-- | src/evalwindow.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/evalwindow.c b/src/evalwindow.c index be6762a5c..c7a9f7960 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -840,6 +840,54 @@ f_win_splitmove(typval_T *argvars, typval_T *rettv) } /* + * "win_gettype(nr)" function + */ + void +f_win_gettype(typval_T *argvars, typval_T *rettv) +{ + win_T *wp = curwin; + + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; + if (argvars[0].v_type != VAR_UNKNOWN) + { + wp = find_win_by_nr_or_id(&argvars[0]); + if (wp == NULL) + { + rettv->vval.v_string = vim_strsave((char_u *)"unknown"); + return; + } + } +#ifdef FEAT_PROP_POPUP + if (WIN_IS_POPUP(wp)) + rettv->vval.v_string = vim_strsave((char_u *)"popup"); + else +#endif +#ifdef FEAT_CMDWIN + if (wp == curwin && cmdwin_type != 0) + rettv->vval.v_string = vim_strsave((char_u *)"command"); +#endif +} + +/* + * "getcmdwintype()" function + */ + void +f_getcmdwintype(typval_T *argvars UNUSED, typval_T *rettv) +{ + rettv->v_type = VAR_STRING; + rettv->vval.v_string = NULL; +#ifdef FEAT_CMDWIN + rettv->vval.v_string = alloc(2); + if (rettv->vval.v_string != NULL) + { + rettv->vval.v_string[0] = cmdwin_type; + rettv->vval.v_string[1] = NUL; + } +#endif +} + +/* * "winbufnr(nr)" function */ void |