comparison src/window.c @ 3263:320cc46d0eb0 v7.3.400

updated for version 7.3.400 Problem: Compiler warnings for shadowed variables. Solution: Remove or rename the variables.
author Bram Moolenaar <bram@vim.org>
date Tue, 10 Jan 2012 22:26:17 +0100
parents 48252b5fd170
children 9ccdc4a69d8f
comparison
equal deleted inserted replaced
3262:373b8b5fee95 3263:320cc46d0eb0
681 681
682 return win_split_ins(size, flags, NULL, 0); 682 return win_split_ins(size, flags, NULL, 0);
683 } 683 }
684 684
685 /* 685 /*
686 * When "newwin" is NULL: split the current window in two. 686 * When "new_wp" is NULL: split the current window in two.
687 * When "newwin" is not NULL: insert this window at the far 687 * When "new_wp" is not NULL: insert this window at the far
688 * top/left/right/bottom. 688 * top/left/right/bottom.
689 * return FAIL for failure, OK otherwise 689 * return FAIL for failure, OK otherwise
690 */ 690 */
691 int 691 int
692 win_split_ins(size, flags, newwin, dir) 692 win_split_ins(size, flags, new_wp, dir)
693 int size; 693 int size;
694 int flags; 694 int flags;
695 win_T *newwin; 695 win_T *new_wp;
696 int dir; 696 int dir;
697 { 697 {
698 win_T *wp = newwin; 698 win_T *wp = new_wp;
699 win_T *oldwin; 699 win_T *oldwin;
700 int new_size = size; 700 int new_size = size;
701 int i; 701 int i;
702 int need_status = 0; 702 int need_status = 0;
703 int do_equal = FALSE; 703 int do_equal = FALSE;
716 oldwin = curwin; 716 oldwin = curwin;
717 717
718 /* add a status line when p_ls == 1 and splitting the first window */ 718 /* add a status line when p_ls == 1 and splitting the first window */
719 if (lastwin == firstwin && p_ls == 1 && oldwin->w_status_height == 0) 719 if (lastwin == firstwin && p_ls == 1 && oldwin->w_status_height == 0)
720 { 720 {
721 if (oldwin->w_height <= p_wmh && newwin == NULL) 721 if (oldwin->w_height <= p_wmh && new_wp == NULL)
722 { 722 {
723 EMSG(_(e_noroom)); 723 EMSG(_(e_noroom));
724 return FAIL; 724 return FAIL;
725 } 725 }
726 need_status = STATUS_HEIGHT; 726 need_status = STATUS_HEIGHT;
749 available = topframe->fr_width; 749 available = topframe->fr_width;
750 needed += frame_minwidth(topframe, NULL); 750 needed += frame_minwidth(topframe, NULL);
751 } 751 }
752 else 752 else
753 available = oldwin->w_width; 753 available = oldwin->w_width;
754 if (available < needed && newwin == NULL) 754 if (available < needed && new_wp == NULL)
755 { 755 {
756 EMSG(_(e_noroom)); 756 EMSG(_(e_noroom));
757 return FAIL; 757 return FAIL;
758 } 758 }
759 if (new_size == 0) 759 if (new_size == 0)
813 else 813 else
814 { 814 {
815 available = oldwin->w_height; 815 available = oldwin->w_height;
816 needed += p_wmh; 816 needed += p_wmh;
817 } 817 }
818 if (available < needed && newwin == NULL) 818 if (available < needed && new_wp == NULL)
819 { 819 {
820 EMSG(_(e_noroom)); 820 EMSG(_(e_noroom));
821 return FAIL; 821 return FAIL;
822 } 822 }
823 oldwin_height = oldwin->w_height; 823 oldwin_height = oldwin->w_height;
886 (flags & WSP_VERT) ? p_spr : 886 (flags & WSP_VERT) ? p_spr :
887 #endif 887 #endif
888 p_sb)))) 888 p_sb))))
889 { 889 {
890 /* new window below/right of current one */ 890 /* new window below/right of current one */
891 if (newwin == NULL) 891 if (new_wp == NULL)
892 wp = win_alloc(oldwin, FALSE); 892 wp = win_alloc(oldwin, FALSE);
893 else 893 else
894 win_append(oldwin, wp); 894 win_append(oldwin, wp);
895 } 895 }
896 else 896 else
897 { 897 {
898 if (newwin == NULL) 898 if (new_wp == NULL)
899 wp = win_alloc(oldwin->w_prev, FALSE); 899 wp = win_alloc(oldwin->w_prev, FALSE);
900 else 900 else
901 win_append(oldwin->w_prev, wp); 901 win_append(oldwin->w_prev, wp);
902 } 902 }
903 903
904 if (newwin == NULL) 904 if (new_wp == NULL)
905 { 905 {
906 if (wp == NULL) 906 if (wp == NULL)
907 return FAIL; 907 return FAIL;
908 908
909 new_frame(wp); 909 new_frame(wp);
970 else 970 else
971 for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next) 971 for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next)
972 frp->fr_parent = curfrp; 972 frp->fr_parent = curfrp;
973 } 973 }
974 974
975 if (newwin == NULL) 975 if (new_wp == NULL)
976 frp = wp->w_frame; 976 frp = wp->w_frame;
977 else 977 else
978 frp = newwin->w_frame; 978 frp = new_wp->w_frame;
979 frp->fr_parent = curfrp->fr_parent; 979 frp->fr_parent = curfrp->fr_parent;
980 980
981 /* Insert the new frame at the right place in the frame list. */ 981 /* Insert the new frame at the right place in the frame list. */
982 if (before) 982 if (before)
983 frame_insert(curfrp, frp); 983 frame_insert(curfrp, frp);
4282 static win_T * 4282 static win_T *
4283 win_alloc(after, hidden) 4283 win_alloc(after, hidden)
4284 win_T *after UNUSED; 4284 win_T *after UNUSED;
4285 int hidden UNUSED; 4285 int hidden UNUSED;
4286 { 4286 {
4287 win_T *newwin; 4287 win_T *new_wp;
4288 4288
4289 /* 4289 /*
4290 * allocate window structure and linesizes arrays 4290 * allocate window structure and linesizes arrays
4291 */ 4291 */
4292 newwin = (win_T *)alloc_clear((unsigned)sizeof(win_T)); 4292 new_wp = (win_T *)alloc_clear((unsigned)sizeof(win_T));
4293 if (newwin != NULL && win_alloc_lines(newwin) == FAIL) 4293 if (new_wp != NULL && win_alloc_lines(new_wp) == FAIL)
4294 { 4294 {
4295 vim_free(newwin); 4295 vim_free(new_wp);
4296 newwin = NULL; 4296 new_wp = NULL;
4297 } 4297 }
4298 4298
4299 if (newwin != NULL) 4299 if (new_wp != NULL)
4300 { 4300 {
4301 #ifdef FEAT_AUTOCMD 4301 #ifdef FEAT_AUTOCMD
4302 /* Don't execute autocommands while the window is not properly 4302 /* Don't execute autocommands while the window is not properly
4303 * initialized yet. gui_create_scrollbar() may trigger a FocusGained 4303 * initialized yet. gui_create_scrollbar() may trigger a FocusGained
4304 * event. */ 4304 * event. */
4307 /* 4307 /*
4308 * link the window in the window list 4308 * link the window in the window list
4309 */ 4309 */
4310 #ifdef FEAT_WINDOWS 4310 #ifdef FEAT_WINDOWS
4311 if (!hidden) 4311 if (!hidden)
4312 win_append(after, newwin); 4312 win_append(after, new_wp);
4313 #endif 4313 #endif
4314 #ifdef FEAT_VERTSPLIT 4314 #ifdef FEAT_VERTSPLIT
4315 newwin->w_wincol = 0; 4315 new_wp->w_wincol = 0;
4316 newwin->w_width = Columns; 4316 new_wp->w_width = Columns;
4317 #endif 4317 #endif
4318 4318
4319 /* position the display and the cursor at the top of the file. */ 4319 /* position the display and the cursor at the top of the file. */
4320 newwin->w_topline = 1; 4320 new_wp->w_topline = 1;
4321 #ifdef FEAT_DIFF 4321 #ifdef FEAT_DIFF
4322 newwin->w_topfill = 0; 4322 new_wp->w_topfill = 0;
4323 #endif 4323 #endif
4324 newwin->w_botline = 2; 4324 new_wp->w_botline = 2;
4325 newwin->w_cursor.lnum = 1; 4325 new_wp->w_cursor.lnum = 1;
4326 #ifdef FEAT_SCROLLBIND 4326 #ifdef FEAT_SCROLLBIND
4327 newwin->w_scbind_pos = 1; 4327 new_wp->w_scbind_pos = 1;
4328 #endif 4328 #endif
4329 4329
4330 /* We won't calculate w_fraction until resizing the window */ 4330 /* We won't calculate w_fraction until resizing the window */
4331 newwin->w_fraction = 0; 4331 new_wp->w_fraction = 0;
4332 newwin->w_prev_fraction_row = -1; 4332 new_wp->w_prev_fraction_row = -1;
4333 4333
4334 #ifdef FEAT_GUI 4334 #ifdef FEAT_GUI
4335 if (gui.in_use) 4335 if (gui.in_use)
4336 { 4336 {
4337 gui_create_scrollbar(&newwin->w_scrollbars[SBAR_LEFT], 4337 gui_create_scrollbar(&new_wp->w_scrollbars[SBAR_LEFT],
4338 SBAR_LEFT, newwin); 4338 SBAR_LEFT, new_wp);
4339 gui_create_scrollbar(&newwin->w_scrollbars[SBAR_RIGHT], 4339 gui_create_scrollbar(&new_wp->w_scrollbars[SBAR_RIGHT],
4340 SBAR_RIGHT, newwin); 4340 SBAR_RIGHT, new_wp);
4341 } 4341 }
4342 #endif 4342 #endif
4343 #ifdef FEAT_EVAL 4343 #ifdef FEAT_EVAL
4344 /* init w: variables */ 4344 /* init w: variables */
4345 init_var_dict(&newwin->w_vars, &newwin->w_winvar); 4345 init_var_dict(&new_wp->w_vars, &new_wp->w_winvar);
4346 #endif 4346 #endif
4347 #ifdef FEAT_FOLDING 4347 #ifdef FEAT_FOLDING
4348 foldInitWin(newwin); 4348 foldInitWin(new_wp);
4349 #endif 4349 #endif
4350 #ifdef FEAT_AUTOCMD 4350 #ifdef FEAT_AUTOCMD
4351 unblock_autocmds(); 4351 unblock_autocmds();
4352 #endif 4352 #endif
4353 #ifdef FEAT_SEARCH_EXTRA 4353 #ifdef FEAT_SEARCH_EXTRA
4354 newwin->w_match_head = NULL; 4354 new_wp->w_match_head = NULL;
4355 newwin->w_next_match_id = 4; 4355 new_wp->w_next_match_id = 4;
4356 #endif 4356 #endif
4357 } 4357 }
4358 return newwin; 4358 return new_wp;
4359 } 4359 }
4360 4360
4361 #if defined(FEAT_WINDOWS) || defined(PROTO) 4361 #if defined(FEAT_WINDOWS) || defined(PROTO)
4362 4362
4363 /* 4363 /*