diff options
author | Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> | 2010-04-24 15:51:13 -0400 |
---|---|---|
committer | Sadrul Habib Chowdhury <sadrul@users.sourceforge.net> | 2010-04-24 15:51:13 -0400 |
commit | a04f24a4456290e00c736d982629aa68dc19a7de (patch) | |
tree | efbce8613d860bdfc637150ca16f3eabb712c400 | |
parent | b1041eb1d85976c9b1d91df2bd88c986d08fc5d5 (diff) | |
download | screen-a04f24a4456290e00c736d982629aa68dc19a7de.tar.gz |
Fix merge.
-rw-r--r-- | src/canvas.c | 38 | ||||
-rw-r--r-- | src/layout.c | 4 |
2 files changed, 21 insertions, 21 deletions
diff --git a/src/canvas.c b/src/canvas.c index 0121892..d7e2a2c 100644 --- a/src/canvas.c +++ b/src/canvas.c @@ -376,7 +376,7 @@ MakeDefaultCanvas() cv->c_xs = 0; cv->c_xe = D_width - 1; cv->c_ys = 0; - cv->c_ye = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - captionalways; + cv->c_ye = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - (captionalways == CAPTION_ALWAYS); debug2("MakeDefaultCanvas 0,0 %d,%d\n", cv->c_xe, cv->c_ye); cv->c_xoff = 0; cv->c_yoff = 0; @@ -462,6 +462,7 @@ struct canvas *cv; int need, got; int xs, ys, xe, ye; int focusmin = 0; + int captspace = 0; /* should we leave a space for caption? */ xs = cv->c_xs; ys = cv->c_ys; @@ -486,6 +487,7 @@ struct canvas *cv; return; } + captspace = (captionalways != CAPTION_NEVER); fcv = 0; if (focusminwidth || focusminheight) { @@ -500,7 +502,7 @@ struct canvas *cv; if (focusmin > 0) focusmin--; else if (focusmin < 0) - focusmin = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2; + focusmin = captspace + (cv->c_slorient == SLICE_VERT ? ye - ys + 1 : xe - xs + 1); debug1("found, focusmin=%d\n", focusmin); } cv2 = cv2->c_slback; @@ -509,7 +511,7 @@ struct canvas *cv; if (focusmin) { m = CountCanvas(cv) * 2; - nh = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2; + nh = captspace + (cv->c_slorient == SLICE_VERT ? ye - ys + 1 : xe - xs + 1); nh -= m; if (nh < 0) nh = 0; @@ -530,10 +532,10 @@ struct canvas *cv; w = wsum; /* pass 2: calculate need/excess space */ - nh = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2; + nh = captspace + (cv->c_slorient == SLICE_VERT ? ye - ys + 1 : xe - xs + 1); for (cv2 = cv, need = got = 0; cv2; cv2 = cv2->c_slnext) { - m = cv2->c_slperp ? CountCanvasPerp(cv2) * 2 - 1 : 1; + m = captionalways != CAPTION_NEVER && cv2->c_slperp ? CountCanvasPerp(cv2) * 2 - 1 : captspace; if (cv2 == fcv) m += focusmin; hh = cv2->c_slweight ? nh * cv2->c_slweight / w : 0; @@ -550,7 +552,7 @@ struct canvas *cv; need = got; /* pass 3: distribute space */ - nh = cv->c_slorient == SLICE_VERT ? ye - ys + 2 : xe - xs + 2; + nh = captspace + (cv->c_slorient == SLICE_VERT ? ye - ys + 1 : xe - xs + 1); i = cv->c_slorient == SLICE_VERT ? ys : xs; maxi = cv->c_slorient == SLICE_VERT ? ye : xe; w = wsum; @@ -562,7 +564,7 @@ struct canvas *cv; if (cv->c_slprev && !cv->c_slback->c_slback && !cv->c_slprev->c_slperp && !cv->c_slprev->c_slprev) { cv->c_slprev->c_slorient = SLICE_UNKN; - if (!captionalways) + if (captionalways != CAPTION_ALWAYS) { cv->c_slback->c_ye++; cv->c_slprev->c_ye++; @@ -572,7 +574,7 @@ struct canvas *cv; FreeCanvas(cv); continue; } - m = cv->c_slperp ? CountCanvasPerp(cv) * 2 - 1 : 1; + m = captionalways != CAPTION_NEVER && cv->c_slperp ? CountCanvasPerp(cv) * 2 - 1 : captspace; if (cv == fcv) m += focusmin; hh = cv->c_slweight ? nh * cv->c_slweight / w : 0; @@ -595,12 +597,12 @@ struct canvas *cv; } ASSERT(hh >= m + 1); /* hh is window size plus pation line */ - if (i + hh > maxi + 2) + if (i + hh > maxi + 1 + captspace) { - hh = maxi + 2 - i; + hh = maxi + 1 + captspace - i; debug1(" not enough space, reducing to %d\n", hh); } - if (i + hh == maxi + 1) + if (i + hh == maxi + captspace) { hh++; debug(" incrementing as no other canvas will fit\n"); @@ -610,18 +612,14 @@ struct canvas *cv; cv->c_xs = xs; cv->c_xe = xe; cv->c_ys = i; - cv->c_ye = i + hh - 2; - cv->c_xoff = xs; - cv->c_yoff = i; + cv->c_ye = i + hh - (1 + captspace); } else { cv->c_xs = i; - cv->c_xe = i + hh - 2; + cv->c_xe = i + hh - (1 + captspace); cv->c_ys = ys; cv->c_ye = ye; - cv->c_xoff = i; - cv->c_yoff = ys; } cv->c_xoff = cv->c_xs; cv->c_yoff = cv->c_ys; @@ -700,7 +698,7 @@ int orient; xe = cv->c_slback->c_xe; ys = cv->c_slback->c_ys; ye = cv->c_slback->c_ye; - if (!captionalways && cv == D_canvas.c_slperp && !cv->c_slnext) + if (captionalways == CAPTION_SPLITONLY && cv == D_canvas.c_slperp && !cv->c_slnext) ye--; /* need space for caption */ debug2("Adding Canvas to slice %d,%d ", xs, ys); debug2("%d,%d\n", xe, ye); @@ -796,7 +794,7 @@ RemCanvas() if (!cv->c_slnext && !cv->c_slprev && !cv->c_slback->c_slback && !cv->c_slperp) { cv->c_slorient = SLICE_UNKN; - if (!captionalways) + if (captionalways != CAPTION_ALWAYS) cv->c_slback->c_ye = ++ye; /* caption line no longer needed */ } cv = cv->c_slback; @@ -839,7 +837,7 @@ OneCanvas() cv->c_slnext = 0; cv->c_slprev = 0; ASSERT(!cv->c_slperp); - if (!captionalways) + if (captionalways == CAPTION_SPLITONLY) D_canvas.c_ye++; /* caption line no longer needed */ ResizeCanvas(&D_canvas); RecreateCanvasChain(); diff --git a/src/layout.c b/src/layout.c index 6100b5d..68f05da 100644 --- a/src/layout.c +++ b/src/layout.c @@ -165,7 +165,9 @@ struct canvas *cv; D_cvlist = 0; D_forecv = lay->lay_forecv; DupLayoutCv(&lay->lay_canvas, &D_canvas, 0); - D_canvas.c_ye = D_height - 1 - ((D_canvas.c_slperp && D_canvas.c_slperp->c_slnext) || captionalways) - (D_has_hstatus == HSTATUS_LASTLINE); + D_canvas.c_ye = D_height - 1 + - ((captionalways == CAPTION_SPLITONLY && D_canvas.c_slperp && D_canvas.c_slperp->c_slnext) || captionalways == CAPTION_ALWAYS) + - (D_has_hstatus == HSTATUS_LASTLINE); ResizeCanvas(&D_canvas); RecreateCanvasChain(); RethinkDisplayViewports(); |