@@ -1440,7 +1440,7 @@ win_T *win_split_ins(int size, int flags, win_T *new_wp, int dir, frame_T *to_fl
1440
1440
}
1441
1441
if (toplevel ) {
1442
1442
if (flags & WSP_BOT ) {
1443
- frame_add_vsep (curfrp );
1443
+ frame_set_vsep (curfrp , true );
1444
1444
}
1445
1445
// Set width of neighbor frame
1446
1446
frame_new_width (curfrp , curfrp -> fr_width
@@ -1547,7 +1547,7 @@ win_T *win_split_ins(int size, int flags, win_T *new_wp, int dir, frame_T *to_fl
1547
1547
}
1548
1548
1549
1549
// equalize the window sizes.
1550
- if (do_equal || dir != 0 ) {
1550
+ if (( do_equal || dir != 0 ) && !( flags & WSP_NOEQUAL ) ) {
1551
1551
win_equal (wp , true, vertical ? (dir == 'v' ? 'b' : 'h' ) : (dir == 'h' ? 'b' : 'v' ));
1552
1552
} else if (!is_aucmd_win (wp )) {
1553
1553
win_fix_scroll (false);
@@ -3218,6 +3218,12 @@ win_T *winframe_remove(win_T *win, int *dirp, tabpage_T *tp, frame_T **unflat_al
3218
3218
int row = topleft -> w_winrow ;
3219
3219
int col = topleft -> w_wincol ;
3220
3220
3221
+ // If this is a rightmost window, remove vertical separators to the left.
3222
+ if (win -> w_vsep_width == 0 && frp_close -> fr_parent -> fr_layout == FR_ROW
3223
+ && frp_close -> fr_prev != NULL ) {
3224
+ frame_set_vsep (frp_close -> fr_prev , false);
3225
+ }
3226
+
3221
3227
// Remove this frame from the list of frames.
3222
3228
frame_remove (frp_close );
3223
3229
@@ -3409,7 +3415,7 @@ void winframe_restore(win_T *wp, int dir, frame_T *unflat_altfr)
3409
3415
3410
3416
// Vertical separators to the left may have been lost. Restore them.
3411
3417
if (wp -> w_vsep_width == 0 && frp -> fr_parent -> fr_layout == FR_ROW && frp -> fr_prev != NULL ) {
3412
- frame_add_vsep (frp -> fr_prev );
3418
+ frame_set_vsep (frp -> fr_prev , true );
3413
3419
}
3414
3420
3415
3421
// Statuslines or horizontal separators above may have been lost. Restore them.
@@ -3855,23 +3861,26 @@ static void frame_new_width(frame_T *topfrp, int width, bool leftfirst, bool wfw
3855
3861
topfrp -> fr_width = width ;
3856
3862
}
3857
3863
3858
- /// Add the vertical separator to windows at the right side of "frp".
3864
+ /// Add or remove the vertical separator to windows at the right side of "frp".
3859
3865
/// Note: Does not check if there is room!
3860
- static void frame_add_vsep (const frame_T * frp )
3866
+ static void frame_set_vsep (const frame_T * frp , bool add )
3861
3867
FUNC_ATTR_NONNULL_ARG (1 )
3862
3868
{
3863
3869
if (frp -> fr_layout == FR_LEAF ) {
3864
3870
win_T * wp = frp -> fr_win ;
3865
- if (wp -> w_vsep_width == 0 ) {
3871
+ if (add && wp -> w_vsep_width == 0 ) {
3866
3872
if (wp -> w_width > 0 ) { // don't make it negative
3867
3873
wp -> w_width -- ;
3868
3874
}
3869
3875
wp -> w_vsep_width = 1 ;
3876
+ } else if (!add && wp -> w_vsep_width == 1 ) {
3877
+ win_new_width (wp , wp -> w_width + 1 );
3878
+ wp -> w_vsep_width = 0 ;
3870
3879
}
3871
3880
} else if (frp -> fr_layout == FR_COL ) {
3872
3881
// Handle all the frames in the column.
3873
3882
FOR_ALL_FRAMES (frp , frp -> fr_child ) {
3874
- frame_add_vsep (frp );
3883
+ frame_set_vsep (frp , add );
3875
3884
}
3876
3885
} else {
3877
3886
assert (frp -> fr_layout == FR_ROW );
@@ -3880,7 +3889,7 @@ static void frame_add_vsep(const frame_T *frp)
3880
3889
while (frp -> fr_next != NULL ) {
3881
3890
frp = frp -> fr_next ;
3882
3891
}
3883
- frame_add_vsep (frp );
3892
+ frame_set_vsep (frp , add );
3884
3893
}
3885
3894
}
3886
3895
0 commit comments