Mercurial > vim
comparison src/misc2.c @ 12477:68d7bc045dbe v8.0.1118
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
commit https://github.com/vim/vim/commit/4033c55eca575777718c0701e26635a0cc47d907
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 16 20:54:51 2017 +0200
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always
enabled and only adds 7% to the binary size of the tiny build.
Solution: Graduate FEAT_WINDOWS.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Sep 2017 21:00:06 +0200 |
parents | 57e0b701611e |
children | 972ea22c946f |
comparison
equal
deleted
inserted
replaced
12476:2516383741e6 | 12477:68d7bc045dbe |
---|---|
167 #ifdef FEAT_VIRTUALEDIT | 167 #ifdef FEAT_VIRTUALEDIT |
168 int width = W_WIDTH(curwin) - win_col_off(curwin); | 168 int width = W_WIDTH(curwin) - win_col_off(curwin); |
169 | 169 |
170 if (finetune | 170 if (finetune |
171 && curwin->w_p_wrap | 171 && curwin->w_p_wrap |
172 # ifdef FEAT_WINDOWS | |
173 && curwin->w_width != 0 | 172 && curwin->w_width != 0 |
174 # endif | |
175 && wcol >= (colnr_T)width) | 173 && wcol >= (colnr_T)width) |
176 { | 174 { |
177 csize = linetabsize(line); | 175 csize = linetabsize(line); |
178 if (csize > 0) | 176 if (csize > 0) |
179 csize--; | 177 csize--; |
1082 # ifdef FEAT_AUTOCMD | 1080 # ifdef FEAT_AUTOCMD |
1083 /* Don't want to trigger autocommands from here on. */ | 1081 /* Don't want to trigger autocommands from here on. */ |
1084 block_autocmds(); | 1082 block_autocmds(); |
1085 # endif | 1083 # endif |
1086 | 1084 |
1087 # ifdef FEAT_WINDOWS | |
1088 /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ | 1085 /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ |
1089 p_ea = FALSE; | 1086 p_ea = FALSE; |
1090 if (first_tabpage->tp_next != NULL) | 1087 if (first_tabpage->tp_next != NULL) |
1091 do_cmdline_cmd((char_u *)"tabonly!"); | 1088 do_cmdline_cmd((char_u *)"tabonly!"); |
1092 if (!ONE_WINDOW) | 1089 if (!ONE_WINDOW) |
1093 do_cmdline_cmd((char_u *)"only!"); | 1090 do_cmdline_cmd((char_u *)"only!"); |
1094 # endif | |
1095 | 1091 |
1096 # if defined(FEAT_SPELL) | 1092 # if defined(FEAT_SPELL) |
1097 /* Free all spell info. */ | 1093 /* Free all spell info. */ |
1098 spell_free_all(); | 1094 spell_free_all(); |
1099 # endif | 1095 # endif |
1195 #endif | 1191 #endif |
1196 | 1192 |
1197 /* Close all script inputs. */ | 1193 /* Close all script inputs. */ |
1198 close_all_scripts(); | 1194 close_all_scripts(); |
1199 | 1195 |
1200 #if defined(FEAT_WINDOWS) | |
1201 /* Destroy all windows. Must come before freeing buffers. */ | 1196 /* Destroy all windows. Must come before freeing buffers. */ |
1202 win_free_all(); | 1197 win_free_all(); |
1203 #endif | |
1204 | 1198 |
1205 /* Free all buffers. Reset 'autochdir' to avoid accessing things that | 1199 /* Free all buffers. Reset 'autochdir' to avoid accessing things that |
1206 * were freed already. */ | 1200 * were freed already. */ |
1207 #ifdef FEAT_AUTOCHDIR | 1201 #ifdef FEAT_AUTOCHDIR |
1208 p_acd = FALSE; | 1202 p_acd = FALSE; |
1236 /* highlight info */ | 1230 /* highlight info */ |
1237 free_highlight(); | 1231 free_highlight(); |
1238 | 1232 |
1239 reset_last_sourcing(); | 1233 reset_last_sourcing(); |
1240 | 1234 |
1241 #ifdef FEAT_WINDOWS | |
1242 free_tabpage(first_tabpage); | 1235 free_tabpage(first_tabpage); |
1243 first_tabpage = NULL; | 1236 first_tabpage = NULL; |
1244 #endif | |
1245 | 1237 |
1246 # ifdef UNIX | 1238 # ifdef UNIX |
1247 /* Machine-specific free. */ | 1239 /* Machine-specific free. */ |
1248 mch_free_mem(); | 1240 mch_free_mem(); |
1249 # endif | 1241 # endif |
3174 } | 3166 } |
3175 if (p != NULL) | 3167 if (p != NULL) |
3176 set_string_option_direct((char_u *)"ff", -1, (char_u *)p, | 3168 set_string_option_direct((char_u *)"ff", -1, (char_u *)p, |
3177 OPT_FREE | opt_flags, 0); | 3169 OPT_FREE | opt_flags, 0); |
3178 | 3170 |
3179 #ifdef FEAT_WINDOWS | |
3180 /* This may cause the buffer to become (un)modified. */ | 3171 /* This may cause the buffer to become (un)modified. */ |
3181 check_status(curbuf); | 3172 check_status(curbuf); |
3182 redraw_tabline = TRUE; | 3173 redraw_tabline = TRUE; |
3183 #endif | |
3184 #ifdef FEAT_TITLE | 3174 #ifdef FEAT_TITLE |
3185 need_maketitle = TRUE; /* set window title later */ | 3175 need_maketitle = TRUE; /* set window title later */ |
3186 #endif | 3176 #endif |
3187 } | 3177 } |
3188 | 3178 |
3351 return (t1 - ffname == t2 - f2 | 3341 return (t1 - ffname == t2 - f2 |
3352 && pathcmp((char *)ffname, (char *)f2, (int)(t1 - ffname)) == 0); | 3342 && pathcmp((char *)ffname, (char *)f2, (int)(t1 - ffname)) == 0); |
3353 } | 3343 } |
3354 | 3344 |
3355 #if defined(FEAT_SESSION) || defined(MSWIN) || defined(FEAT_GUI_MAC) \ | 3345 #if defined(FEAT_SESSION) || defined(MSWIN) || defined(FEAT_GUI_MAC) \ |
3356 || ((defined(FEAT_GUI_GTK)) \ | 3346 || defined(FEAT_GUI_GTK) \ |
3357 && ( defined(FEAT_WINDOWS) || defined(FEAT_DND)) ) \ | |
3358 || defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG) \ | 3347 || defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG) \ |
3359 || defined(PROTO) | 3348 || defined(PROTO) |
3360 /* | 3349 /* |
3361 * Change to a file's directory. | 3350 * Change to a file's directory. |
3362 * Caller must call shorten_fnames()! | 3351 * Caller must call shorten_fnames()! |
3726 # endif | 3715 # endif |
3727 return SHAPE_IDX_MORE; | 3716 return SHAPE_IDX_MORE; |
3728 } | 3717 } |
3729 if (mouse && drag_status_line) | 3718 if (mouse && drag_status_line) |
3730 return SHAPE_IDX_SDRAG; | 3719 return SHAPE_IDX_SDRAG; |
3731 # ifdef FEAT_WINDOWS | |
3732 if (mouse && drag_sep_line) | 3720 if (mouse && drag_sep_line) |
3733 return SHAPE_IDX_VDRAG; | 3721 return SHAPE_IDX_VDRAG; |
3734 # endif | |
3735 #endif | 3722 #endif |
3736 if (!mouse && State == SHOWMATCH) | 3723 if (!mouse && State == SHOWMATCH) |
3737 return SHAPE_IDX_SM; | 3724 return SHAPE_IDX_SM; |
3738 #ifdef FEAT_VREPLACE | 3725 #ifdef FEAT_VREPLACE |
3739 if (State & VREPLACE_FLAG) | 3726 if (State & VREPLACE_FLAG) |