Mercurial > vim
comparison src/window.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 | f2f35161d75a |
children | 57ebc2a4d2ca |
comparison
equal
deleted
inserted
replaced
30644:0c102a723b9a | 30645:101f08b49ed3 |
---|---|
117 * set, then return "prevwin". | 117 * set, then return "prevwin". |
118 */ | 118 */ |
119 win_T * | 119 win_T * |
120 prevwin_curwin(void) | 120 prevwin_curwin(void) |
121 { | 121 { |
122 return | 122 // In cmdwin, the alternative buffer should be used. |
123 #ifdef FEAT_CMDWIN | 123 return is_in_cmdwin() && prevwin != NULL ? prevwin : curwin; |
124 // In cmdwin, the alternative buffer should be used. | |
125 is_in_cmdwin() && prevwin != NULL ? prevwin : | |
126 #endif | |
127 curwin; | |
128 } | 124 } |
129 | 125 |
130 /* | 126 /* |
131 * All CTRL-W window commands are handled here, called from normal_cmd(). | 127 * All CTRL-W window commands are handled here, called from normal_cmd(). |
132 */ | 128 */ |
147 char_u cbuf[40]; | 143 char_u cbuf[40]; |
148 | 144 |
149 if (ERROR_IF_ANY_POPUP_WINDOW) | 145 if (ERROR_IF_ANY_POPUP_WINDOW) |
150 return; | 146 return; |
151 | 147 |
152 #ifdef FEAT_CMDWIN | 148 #define CHECK_CMDWIN \ |
153 # define CHECK_CMDWIN \ | |
154 do { \ | 149 do { \ |
155 if (cmdwin_type != 0) \ | 150 if (cmdwin_type != 0) \ |
156 { \ | 151 { \ |
157 emsg(_(e_invalid_in_cmdline_window)); \ | 152 emsg(_(e_invalid_in_cmdline_window)); \ |
158 return; \ | 153 return; \ |
159 } \ | 154 } \ |
160 } while (0) | 155 } while (0) |
161 #else | |
162 # define CHECK_CMDWIN do { /**/ } while (0) | |
163 #endif | |
164 | 156 |
165 Prenum1 = Prenum == 0 ? 1 : Prenum; | 157 Prenum1 = Prenum == 0 ? 1 : Prenum; |
166 | 158 |
167 switch (nchar) | 159 switch (nchar) |
168 { | 160 { |
2961 void | 2953 void |
2962 win_free_all(void) | 2954 win_free_all(void) |
2963 { | 2955 { |
2964 int dummy; | 2956 int dummy; |
2965 | 2957 |
2966 #ifdef FEAT_CMDWIN | |
2967 // avoid an error for switching tabpage with the cmdline window open | 2958 // avoid an error for switching tabpage with the cmdline window open |
2968 cmdwin_type = 0; | 2959 cmdwin_type = 0; |
2969 #endif | 2960 |
2970 while (first_tabpage->tp_next != NULL) | 2961 while (first_tabpage->tp_next != NULL) |
2971 tabpage_close(TRUE); | 2962 tabpage_close(TRUE); |
2972 | 2963 |
2973 if (aucmd_win != NULL) | 2964 if (aucmd_win != NULL) |
2974 { | 2965 { |
4017 tabpage_T *tp = curtab; | 4008 tabpage_T *tp = curtab; |
4018 tabpage_T *prev_tp = curtab; | 4009 tabpage_T *prev_tp = curtab; |
4019 tabpage_T *newtp; | 4010 tabpage_T *newtp; |
4020 int n; | 4011 int n; |
4021 | 4012 |
4022 #ifdef FEAT_CMDWIN | |
4023 if (cmdwin_type != 0) | 4013 if (cmdwin_type != 0) |
4024 { | 4014 { |
4025 emsg(_(e_invalid_in_cmdline_window)); | 4015 emsg(_(e_invalid_in_cmdline_window)); |
4026 return FAIL; | 4016 return FAIL; |
4027 } | 4017 } |
4028 #endif | |
4029 | 4018 |
4030 newtp = alloc_tabpage(); | 4019 newtp = alloc_tabpage(); |
4031 if (newtp == NULL) | 4020 if (newtp == NULL) |
4032 return FAIL; | 4021 return FAIL; |
4033 | 4022 |
5511 if (p_ea) | 5500 if (p_ea) |
5512 win_equal(curwin, FALSE, 'h'); | 5501 win_equal(curwin, FALSE, 'h'); |
5513 #endif | 5502 #endif |
5514 } | 5503 } |
5515 | 5504 |
5516 #if defined(FEAT_CMDWIN) || defined(PROTO) | |
5517 /* | 5505 /* |
5518 * Save the size of all windows in "gap". | 5506 * Save the size of all windows in "gap". |
5519 */ | 5507 */ |
5520 void | 5508 void |
5521 win_size_save(garray_T *gap) | 5509 win_size_save(garray_T *gap) |
5565 } | 5553 } |
5566 // recompute the window positions | 5554 // recompute the window positions |
5567 (void)win_comp_pos(); | 5555 (void)win_comp_pos(); |
5568 } | 5556 } |
5569 } | 5557 } |
5570 #endif // FEAT_CMDWIN | |
5571 | 5558 |
5572 /* | 5559 /* |
5573 * Update the position for all windows, using the width and height of the | 5560 * Update the position for all windows, using the width and height of the |
5574 * frames. | 5561 * frames. |
5575 * Returns the row just after the last window. | 5562 * Returns the row just after the last window. |
6417 linenr_T bot; | 6404 linenr_T bot; |
6418 linenr_T top; | 6405 linenr_T top; |
6419 | 6406 |
6420 if (wp->w_buffer->b_ml.ml_line_count < wp->w_height) | 6407 if (wp->w_buffer->b_ml.ml_line_count < wp->w_height) |
6421 return; | 6408 return; |
6422 #ifdef FEAT_CMDWIN | |
6423 if (skip_win_fix_cursor) | 6409 if (skip_win_fix_cursor) |
6424 return; | 6410 return; |
6425 #endif | 6411 |
6426 // Determine valid cursor range. | 6412 // Determine valid cursor range. |
6427 so = MIN(wp->w_height / 2, so); | 6413 so = MIN(wp->w_height / 2, so); |
6428 wp->w_cursor.lnum = wp->w_topline; | 6414 wp->w_cursor.lnum = wp->w_topline; |
6429 top = cursor_down_inner(wp, so); | 6415 top = cursor_down_inner(wp, so); |
6430 wp->w_cursor.lnum = wp->w_botline - 1; | 6416 wp->w_cursor.lnum = wp->w_botline - 1; |