comparison src/window.c @ 5004:a1b41dabc682 v7.3.1246

updated for version 7.3.1246 Problem: When setting 'winfixheight' and resizing the window causes the window layout to be wrong. Solution: Add frame_check_height() and frame_check_width() (Yukihiro Nakadaira)
author Bram Moolenaar <bram@vim.org>
date Wed, 26 Jun 2013 14:04:47 +0200
parents ae05437a744a
children 322441058afc
comparison
equal deleted inserted replaced
5003:ad6996a23e3e 5004:a1b41dabc682
63 static void make_snapshot_rec __ARGS((frame_T *fr, frame_T **frp)); 63 static void make_snapshot_rec __ARGS((frame_T *fr, frame_T **frp));
64 static void clear_snapshot __ARGS((tabpage_T *tp, int idx)); 64 static void clear_snapshot __ARGS((tabpage_T *tp, int idx));
65 static void clear_snapshot_rec __ARGS((frame_T *fr)); 65 static void clear_snapshot_rec __ARGS((frame_T *fr));
66 static int check_snapshot_rec __ARGS((frame_T *sn, frame_T *fr)); 66 static int check_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
67 static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr)); 67 static win_T *restore_snapshot_rec __ARGS((frame_T *sn, frame_T *fr));
68
69 static int frame_check_height __ARGS((frame_T *topfrp, int height));
70 #ifdef FEAT_VERTSPLIT
71 static int frame_check_width __ARGS((frame_T *topfrp, int width));
72 #endif
68 73
69 #endif /* FEAT_WINDOWS */ 74 #endif /* FEAT_WINDOWS */
70 75
71 static win_T *win_alloc __ARGS((win_T *after, int hidden)); 76 static win_T *win_alloc __ARGS((win_T *after, int hidden));
72 static void set_fraction __ARGS((win_T *wp)); 77 static void set_fraction __ARGS((win_T *wp));
4747 h = frame_minheight(topframe, NULL); 4752 h = frame_minheight(topframe, NULL);
4748 4753
4749 /* First try setting the heights of windows with 'winfixheight'. If 4754 /* First try setting the heights of windows with 'winfixheight'. If
4750 * that doesn't result in the right height, forget about that option. */ 4755 * that doesn't result in the right height, forget about that option. */
4751 frame_new_height(topframe, h, FALSE, TRUE); 4756 frame_new_height(topframe, h, FALSE, TRUE);
4752 if (topframe->fr_height != h) 4757 if (!frame_check_height(topframe, h))
4753 frame_new_height(topframe, h, FALSE, FALSE); 4758 frame_new_height(topframe, h, FALSE, FALSE);
4754 4759
4755 (void)win_comp_pos(); /* recompute w_winrow and w_wincol */ 4760 (void)win_comp_pos(); /* recompute w_winrow and w_wincol */
4756 #else 4761 #else
4757 if (h < 1) 4762 if (h < 1)
4781 return; 4786 return;
4782 4787
4783 /* First try setting the widths of windows with 'winfixwidth'. If that 4788 /* First try setting the widths of windows with 'winfixwidth'. If that
4784 * doesn't result in the right width, forget about that option. */ 4789 * doesn't result in the right width, forget about that option. */
4785 frame_new_width(topframe, (int)Columns, FALSE, TRUE); 4790 frame_new_width(topframe, (int)Columns, FALSE, TRUE);
4786 if (topframe->fr_width != Columns) 4791 if (!frame_check_width(topframe, Columns))
4787 frame_new_width(topframe, (int)Columns, FALSE, FALSE); 4792 frame_new_width(topframe, (int)Columns, FALSE, FALSE);
4788 4793
4789 (void)win_comp_pos(); /* recompute w_winrow and w_wincol */ 4794 (void)win_comp_pos(); /* recompute w_winrow and w_wincol */
4790 #if 0 4795 #if 0
4791 /* Disabled: don't want making the screen smaller make a window larger. */ 4796 /* Disabled: don't want making the screen smaller make a window larger. */
6920 else 6925 else
6921 # endif 6926 # endif
6922 return i; 6927 return i;
6923 } 6928 }
6924 #endif 6929 #endif
6930
6931 /*
6932 * Return TRUE if "topfrp" and its children are at the right height.
6933 */
6934 static int
6935 frame_check_height(topfrp, height)
6936 frame_T *topfrp;
6937 int height;
6938 {
6939 frame_T *frp;
6940
6941 if (topfrp->fr_height != height)
6942 return FALSE;
6943
6944 if (topfrp->fr_layout == FR_ROW)
6945 for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
6946 if (frp->fr_height != height)
6947 return FALSE;
6948
6949 return TRUE;
6950 }
6951
6952 #ifdef FEAT_VERTSPLIT
6953 /*
6954 * Return TRUE if "topfrp" and its children are at the right width.
6955 */
6956 static int
6957 frame_check_width(topfrp, width)
6958 frame_T *topfrp;
6959 int width;
6960 {
6961 frame_T *frp;
6962
6963 if (topfrp->fr_width != width)
6964 return FALSE;
6965
6966 if (topfrp->fr_layout == FR_COL)
6967 for (frp = topfrp->fr_child; frp != NULL; frp = frp->fr_next)
6968 if (frp->fr_width != width)
6969 return FALSE;
6970
6971 return TRUE;
6972 }
6973 #endif
6974