comparison src/ex_docmd.c @ 30645:101f08b49ed3 v9.0.0657

patch 9.0.0657: too many #ifdefs Commit: https://github.com/vim/vim/commit/7904fa420eb577274c4c3711295240100167d495 Author: Martin Tournoij <martin@arp242.net> Date: Tue Oct 4 16:28:45 2022 +0100 patch 9.0.0657: too many #ifdefs Problem: Too many #ifdefs. Solution: Graduate the +cmdwin feature. Now the tiny and small builds are equal, drop the small build. (Martin Tournoij, closes #11268)
author Bram Moolenaar <Bram@vim.org>
date Tue, 04 Oct 2022 17:30:06 +0200
parents 9d7914012b82
children 12e6c7bae2a9
comparison
equal deleted inserted replaced
30644:0c102a723b9a 30645:101f08b49ed3
2081 goto doend; 2081 goto doend;
2082 } 2082 }
2083 2083
2084 if (!IS_USER_CMDIDX(ea.cmdidx)) 2084 if (!IS_USER_CMDIDX(ea.cmdidx))
2085 { 2085 {
2086 #ifdef FEAT_CMDWIN
2087 if (cmdwin_type != 0 && !(ea.argt & EX_CMDWIN)) 2086 if (cmdwin_type != 0 && !(ea.argt & EX_CMDWIN))
2088 { 2087 {
2089 // Command not allowed in the command line window 2088 // Command not allowed in the command line window
2090 errormsg = _(e_invalid_in_cmdline_window); 2089 errormsg = _(e_invalid_in_cmdline_window);
2091 goto doend; 2090 goto doend;
2092 } 2091 }
2093 #endif
2094 if (text_locked() && !(ea.argt & EX_LOCK_OK)) 2092 if (text_locked() && !(ea.argt & EX_LOCK_OK))
2095 { 2093 {
2096 // Command not allowed when text is locked 2094 // Command not allowed when text is locked
2097 errormsg = _(get_text_locked_msg()); 2095 errormsg = _(get_text_locked_msg());
2098 goto doend; 2096 goto doend;
5847 void 5845 void
5848 ex_quit(exarg_T *eap) 5846 ex_quit(exarg_T *eap)
5849 { 5847 {
5850 win_T *wp; 5848 win_T *wp;
5851 5849
5852 #ifdef FEAT_CMDWIN
5853 if (cmdwin_type != 0) 5850 if (cmdwin_type != 0)
5854 { 5851 {
5855 cmdwin_result = Ctrl_C; 5852 cmdwin_result = Ctrl_C;
5856 return; 5853 return;
5857 } 5854 }
5858 #endif
5859 // Don't quit while editing the command line. 5855 // Don't quit while editing the command line.
5860 if (text_locked()) 5856 if (text_locked())
5861 { 5857 {
5862 text_locked_msg(); 5858 text_locked_msg();
5863 return; 5859 return;
5932 * ":qall": try to quit all windows 5928 * ":qall": try to quit all windows
5933 */ 5929 */
5934 static void 5930 static void
5935 ex_quit_all(exarg_T *eap) 5931 ex_quit_all(exarg_T *eap)
5936 { 5932 {
5937 # ifdef FEAT_CMDWIN
5938 if (cmdwin_type != 0) 5933 if (cmdwin_type != 0)
5939 { 5934 {
5940 if (eap->forceit) 5935 if (eap->forceit)
5941 cmdwin_result = K_XF1; // ex_window() takes care of this 5936 cmdwin_result = K_XF1; // ex_window() takes care of this
5942 else 5937 else
5943 cmdwin_result = K_XF2; 5938 cmdwin_result = K_XF2;
5944 return; 5939 return;
5945 } 5940 }
5946 # endif
5947 5941
5948 // Don't quit while editing the command line. 5942 // Don't quit while editing the command line.
5949 if (text_locked()) 5943 if (text_locked())
5950 { 5944 {
5951 text_locked_msg(); 5945 text_locked_msg();
5967 static void 5961 static void
5968 ex_close(exarg_T *eap) 5962 ex_close(exarg_T *eap)
5969 { 5963 {
5970 win_T *win; 5964 win_T *win;
5971 int winnr = 0; 5965 int winnr = 0;
5972 #ifdef FEAT_CMDWIN
5973 if (cmdwin_type != 0) 5966 if (cmdwin_type != 0)
5974 cmdwin_result = Ctrl_C; 5967 cmdwin_result = Ctrl_C;
5975 else 5968 else
5976 #endif
5977 if (!text_locked() && !curbuf_locked()) 5969 if (!text_locked() && !curbuf_locked())
5978 { 5970 {
5979 if (eap->addr_count == 0) 5971 if (eap->addr_count == 0)
5980 ex_win_close(eap->forceit, curwin, NULL); 5972 ex_win_close(eap->forceit, curwin, NULL);
5981 else 5973 else
6187 ex_tabclose(exarg_T *eap) 6179 ex_tabclose(exarg_T *eap)
6188 { 6180 {
6189 tabpage_T *tp; 6181 tabpage_T *tp;
6190 int tab_number; 6182 int tab_number;
6191 6183
6192 # ifdef FEAT_CMDWIN
6193 if (cmdwin_type != 0) 6184 if (cmdwin_type != 0)
6194 cmdwin_result = K_IGNORE; 6185 cmdwin_result = K_IGNORE;
6186 else if (first_tabpage->tp_next == NULL)
6187 emsg(_(e_cannot_close_last_tab_page));
6195 else 6188 else
6196 # endif 6189 {
6197 if (first_tabpage->tp_next == NULL) 6190 tab_number = get_tabpage_arg(eap);
6198 emsg(_(e_cannot_close_last_tab_page)); 6191 if (eap->errmsg == NULL)
6199 else 6192 {
6200 { 6193 tp = find_tabpage(tab_number);
6201 tab_number = get_tabpage_arg(eap); 6194 if (tp == NULL)
6202 if (eap->errmsg == NULL)
6203 { 6195 {
6204 tp = find_tabpage(tab_number); 6196 beep_flush();
6205 if (tp == NULL) 6197 return;
6206 {
6207 beep_flush();
6208 return;
6209 }
6210 if (tp != curtab)
6211 {
6212 tabpage_close_other(tp, eap->forceit);
6213 return;
6214 }
6215 else if (!text_locked() && !curbuf_locked())
6216 tabpage_close(eap->forceit);
6217 } 6198 }
6218 } 6199 if (tp != curtab)
6200 {
6201 tabpage_close_other(tp, eap->forceit);
6202 return;
6203 }
6204 else if (!text_locked() && !curbuf_locked())
6205 tabpage_close(eap->forceit);
6206 }
6207 }
6219 } 6208 }
6220 6209
6221 /* 6210 /*
6222 * ":tabonly": close all tab pages except the current one 6211 * ":tabonly": close all tab pages except the current one
6223 */ 6212 */
6226 { 6215 {
6227 tabpage_T *tp; 6216 tabpage_T *tp;
6228 int done; 6217 int done;
6229 int tab_number; 6218 int tab_number;
6230 6219
6231 # ifdef FEAT_CMDWIN
6232 if (cmdwin_type != 0) 6220 if (cmdwin_type != 0)
6233 cmdwin_result = K_IGNORE; 6221 cmdwin_result = K_IGNORE;
6222 else if (first_tabpage->tp_next == NULL)
6223 msg(_("Already only one tab page"));
6234 else 6224 else
6235 # endif 6225 {
6236 if (first_tabpage->tp_next == NULL) 6226 tab_number = get_tabpage_arg(eap);
6237 msg(_("Already only one tab page")); 6227 if (eap->errmsg == NULL)
6238 else 6228 {
6239 { 6229 goto_tabpage(tab_number);
6240 tab_number = get_tabpage_arg(eap); 6230 // Repeat this up to a 1000 times, because autocommands may
6241 if (eap->errmsg == NULL) 6231 // mess up the lists.
6232 for (done = 0; done < 1000; ++done)
6242 { 6233 {
6243 goto_tabpage(tab_number); 6234 FOR_ALL_TABPAGES(tp)
6244 // Repeat this up to a 1000 times, because autocommands may 6235 if (tp->tp_topframe != topframe)
6245 // mess up the lists. 6236 {
6246 for (done = 0; done < 1000; ++done) 6237 tabpage_close_other(tp, eap->forceit);
6247 { 6238 // if we failed to close it quit
6248 FOR_ALL_TABPAGES(tp) 6239 if (valid_tabpage(tp))
6249 if (tp->tp_topframe != topframe) 6240 done = 1000;
6250 { 6241 // start over, "tp" is now invalid
6251 tabpage_close_other(tp, eap->forceit);
6252 // if we failed to close it quit
6253 if (valid_tabpage(tp))
6254 done = 1000;
6255 // start over, "tp" is now invalid
6256 break;
6257 }
6258 if (first_tabpage->tp_next == NULL)
6259 break; 6242 break;
6260 } 6243 }
6244 if (first_tabpage->tp_next == NULL)
6245 break;
6261 } 6246 }
6262 } 6247 }
6248 }
6263 } 6249 }
6264 6250
6265 /* 6251 /*
6266 * Close the current tab page. 6252 * Close the current tab page.
6267 */ 6253 */
6401 { 6387 {
6402 #ifdef FEAT_EVAL 6388 #ifdef FEAT_EVAL
6403 if (not_in_vim9(eap) == FAIL) 6389 if (not_in_vim9(eap) == FAIL)
6404 return; 6390 return;
6405 #endif 6391 #endif
6406 #ifdef FEAT_CMDWIN
6407 if (cmdwin_type != 0) 6392 if (cmdwin_type != 0)
6408 { 6393 {
6409 cmdwin_result = Ctrl_C; 6394 cmdwin_result = Ctrl_C;
6410 return; 6395 return;
6411 } 6396 }
6412 #endif
6413 // Don't quit while editing the command line. 6397 // Don't quit while editing the command line.
6414 if (text_locked()) 6398 if (text_locked())
6415 { 6399 {
6416 text_locked_msg(); 6400 text_locked_msg();
6417 return; 6401 return;