comparison src/evalfunc.c @ 9881:4b53f6be10c0 v7.4.2215

commit https://github.com/vim/vim/commit/386600f0cbcb8add099c723cf84634f46df2f788 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 15 22:16:25 2016 +0200 patch 7.4.2215 Problem: It's not easy to find out if a window is a quickfix or location list window. Solution: Add "loclist" and "quickfix" entries to the dict returnec by getwininfo(). (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Mon, 15 Aug 2016 22:30:06 +0200
parents cbe23f6769f9
children bff8a09016a5
comparison
equal deleted inserted replaced
9880:d81d2a3adf1f 9881:4b53f6be10c0
4025 if (argbuf == NULL) 4025 if (argbuf == NULL)
4026 return; 4026 return;
4027 } 4027 }
4028 4028
4029 /* Return information about all the buffers or a specified buffer */ 4029 /* Return information about all the buffers or a specified buffer */
4030 for (buf = firstbuf; buf != NULL; buf = buf->b_next) 4030 FOR_ALL_BUFFERS(buf)
4031 { 4031 {
4032 if (argbuf != NULL && argbuf != buf) 4032 if (argbuf != NULL && argbuf != buf)
4033 continue; 4033 continue;
4034 if (filtered && ((sel_bufloaded && buf->b_ml.ml_mfp == NULL) 4034 if (filtered && ((sel_bufloaded && buf->b_ml.ml_mfp == NULL)
4035 || (sel_buflisted && !buf->b_p_bl))) 4035 || (sel_buflisted && !buf->b_p_bl)))
5028 f_gettabinfo(typval_T *argvars, typval_T *rettv) 5028 f_gettabinfo(typval_T *argvars, typval_T *rettv)
5029 { 5029 {
5030 #ifdef FEAT_WINDOWS 5030 #ifdef FEAT_WINDOWS
5031 tabpage_T *tp, *tparg = NULL; 5031 tabpage_T *tp, *tparg = NULL;
5032 dict_T *d; 5032 dict_T *d;
5033 int tpnr = 1; 5033 int tpnr = 0;
5034 5034
5035 if (rettv_list_alloc(rettv) != OK) 5035 if (rettv_list_alloc(rettv) != OK)
5036 return; 5036 return;
5037 5037
5038 if (argvars[0].v_type != VAR_UNKNOWN) 5038 if (argvars[0].v_type != VAR_UNKNOWN)
5042 if (tparg == NULL) 5042 if (tparg == NULL)
5043 return; 5043 return;
5044 } 5044 }
5045 5045
5046 /* Get information about a specific tab page or all tab pages */ 5046 /* Get information about a specific tab page or all tab pages */
5047 for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, tpnr++) 5047 FOR_ALL_TABPAGES(tp)
5048 { 5048 {
5049 tpnr++;
5049 if (tparg != NULL && tp != tparg) 5050 if (tparg != NULL && tp != tparg)
5050 continue; 5051 continue;
5051 d = get_tabpage_info(tp, tpnr); 5052 d = get_tabpage_info(tp, tpnr);
5052 if (d != NULL) 5053 if (d != NULL)
5053 list_append_dict(rettv->vval.v_list, d); 5054 list_append_dict(rettv->vval.v_list, d);
5129 dict_add_nr_str(dict, "winid", wp->w_id, NULL); 5130 dict_add_nr_str(dict, "winid", wp->w_id, NULL);
5130 dict_add_nr_str(dict, "height", wp->w_height, NULL); 5131 dict_add_nr_str(dict, "height", wp->w_height, NULL);
5131 dict_add_nr_str(dict, "width", wp->w_width, NULL); 5132 dict_add_nr_str(dict, "width", wp->w_width, NULL);
5132 dict_add_nr_str(dict, "bufnum", wp->w_buffer->b_fnum, NULL); 5133 dict_add_nr_str(dict, "bufnum", wp->w_buffer->b_fnum, NULL);
5133 5134
5135 #ifdef FEAT_QUICKFIX
5136 dict_add_nr_str(dict, "quickfix", bt_quickfix(wp->w_buffer), NULL);
5137 dict_add_nr_str(dict, "loclist",
5138 (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL), NULL);
5139 #endif
5140
5134 /* Copy window variables */ 5141 /* Copy window variables */
5135 vars = dict_copy(wp->w_vars, TRUE, 0); 5142 vars = dict_copy(wp->w_vars, TRUE, 0);
5136 if (vars != NULL) 5143 if (vars != NULL)
5137 dict_add_dict(dict, "variables", vars); 5144 dict_add_dict(dict, "variables", vars);
5138 5145
5153 { 5160 {
5154 #ifdef FEAT_WINDOWS 5161 #ifdef FEAT_WINDOWS
5155 tabpage_T *tp; 5162 tabpage_T *tp;
5156 win_T *wp = NULL, *wparg = NULL; 5163 win_T *wp = NULL, *wparg = NULL;
5157 dict_T *d; 5164 dict_T *d;
5158 short tabnr, winnr; 5165 short tabnr = 0, winnr;
5159 #endif 5166 #endif
5160 5167
5161 if (rettv_list_alloc(rettv) != OK) 5168 if (rettv_list_alloc(rettv) != OK)
5162 return; 5169 return;
5163 5170
5170 } 5177 }
5171 5178
5172 /* Collect information about either all the windows across all the tab 5179 /* Collect information about either all the windows across all the tab
5173 * pages or one particular window. 5180 * pages or one particular window.
5174 */ 5181 */
5175 tabnr = 1; 5182 FOR_ALL_TABPAGES(tp)
5176 for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, tabnr++) 5183 {
5177 { 5184 tabnr++;
5178 wp = (tp == curtab) ? firstwin : tp->tp_firstwin; 5185 winnr = 0;
5179 winnr = 1; 5186 FOR_ALL_WINDOWS_IN_TAB(tp, wp)
5180 for (; wp; wp = wp->w_next, winnr++) 5187 {
5181 { 5188 winnr++;
5182 if (wparg != NULL && wp != wparg) 5189 if (wparg != NULL && wp != wparg)
5183 continue; 5190 continue;
5184 d = get_win_info(wp, tabnr, winnr); 5191 d = get_win_info(wp, tabnr, winnr);
5185 if (d != NULL) 5192 if (d != NULL)
5186 list_append_dict(rettv->vval.v_list, d); 5193 list_append_dict(rettv->vval.v_list, d);