mirror of
https://git.savannah.gnu.org/git/screen.git
synced 2026-04-10 06:03:38 +02:00
Compare commits
4 Commits
v.4.6.0
...
caption-ne
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c80e5ec48f | ||
|
|
a04f24a445 | ||
|
|
b1041eb1d8 | ||
|
|
3e2600969e |
38
src/canvas.c
38
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();
|
||||
|
||||
@@ -125,7 +125,7 @@ int defmousetrack = 0;
|
||||
#ifdef AUTO_NUKE
|
||||
int defautonuke = 0;
|
||||
#endif
|
||||
int captionalways;
|
||||
int captionalways = CAPTION_SPLITONLY;
|
||||
int hardstatusemu = HSTATUS_IGNORE;
|
||||
|
||||
int focusminwidth, focusminheight;
|
||||
@@ -2085,7 +2085,8 @@ RemoveStatus()
|
||||
oldflayer = flayer;
|
||||
if (where == STATUS_ON_WIN)
|
||||
{
|
||||
if (captionalways || (D_canvas.c_slperp && D_canvas.c_slperp->c_slnext))
|
||||
if (captionalways == CAPTION_ALWAYS ||
|
||||
(captionalways == CAPTION_SPLITONLY && D_canvas.c_slperp && D_canvas.c_slperp->c_slnext))
|
||||
{
|
||||
GotoPos(0, STATLINE);
|
||||
RefreshLine(STATLINE, 0, D_status_len - 1, 0);
|
||||
@@ -2216,6 +2217,8 @@ char *str;
|
||||
}
|
||||
else if (D_has_hstatus == HSTATUS_LASTLINE)
|
||||
{
|
||||
int hascaption = ((captionalways == CAPTION_ALWAYS) ||
|
||||
(captionalways == CAPTION_SPLITONLY && D_cvlist && D_cvlist->c_next));
|
||||
debug("ShowHStatus: using last line\n");
|
||||
ox = D_x;
|
||||
oy = D_y;
|
||||
@@ -2224,9 +2227,9 @@ char *str;
|
||||
if (l > D_width)
|
||||
l = D_width;
|
||||
GotoPos(0, D_height - 1);
|
||||
SetRendition(captionalways || D_cvlist == 0 || D_cvlist->c_next ? &mchar_null: &mchar_so);
|
||||
SetRendition(hascaption ? &mchar_null: &mchar_so);
|
||||
l = PrePutWinMsg(str, 0, l);
|
||||
if (!captionalways && D_cvlist && !D_cvlist->c_next)
|
||||
if (!hascaption)
|
||||
while (l++ < D_width)
|
||||
PUTCHARLP(' ');
|
||||
if (l < D_width)
|
||||
@@ -2348,7 +2351,7 @@ int y, from, to, isblank;
|
||||
lvp = 0;
|
||||
for (cv = display->d_cvlist; cv; cv = cv->c_next)
|
||||
{
|
||||
if (y == cv->c_ye + 1 && from >= cv->c_xs && from <= cv->c_xe)
|
||||
if (captionalways != CAPTION_NEVER && y == cv->c_ye + 1 && from >= cv->c_xs && from <= cv->c_xe)
|
||||
{
|
||||
p = Layer2Window(cv->c_layer);
|
||||
buf = MakeWinMsgEv(captionstring, p, '%', cv->c_xe - cv->c_xs + (cv->c_xe + 1 < D_width || D_CLP), &cv->c_captev, 0);
|
||||
@@ -2366,7 +2369,7 @@ int y, from, to, isblank;
|
||||
PUTCHARLP(' ');
|
||||
break;
|
||||
}
|
||||
if (from == cv->c_xe + 1 && y >= cv->c_ys && y <= cv->c_ye + 1)
|
||||
if (captionalways != CAPTION_NEVER && from == cv->c_xe + 1 && y >= cv->c_ys && y <= cv->c_ye + 1)
|
||||
{
|
||||
GotoPos(from, y);
|
||||
SetRendition(&mchar_so);
|
||||
@@ -3779,4 +3782,3 @@ char **cmdv;
|
||||
|
||||
#endif /* BLANKER_PRG */
|
||||
|
||||
|
||||
|
||||
@@ -322,5 +322,9 @@ while (0)
|
||||
#define HSTATUS_HS 3
|
||||
#define HSTATUS_ALWAYS (1<<2)
|
||||
|
||||
#define CAPTION_SPLITONLY 0
|
||||
#define CAPTION_ALWAYS 1
|
||||
#define CAPTION_NEVER 2
|
||||
|
||||
#endif /* SCREEN_DISPLAY_H */
|
||||
|
||||
|
||||
@@ -1167,13 +1167,18 @@ c1 positions may want to turn this off.
|
||||
.br
|
||||
.B "caption string"
|
||||
.RI [ string ]
|
||||
.br
|
||||
.B "caption never"
|
||||
.PP
|
||||
This command controls the display of the window captions. Normally
|
||||
a caption is only used if more than one window is shown on the
|
||||
display (split screen mode). But if the type is set to
|
||||
.B always
|
||||
screen shows a caption even if only one window is displayed. The default
|
||||
is
|
||||
screen shows a caption even if only one window is displayed. If the
|
||||
type is set to
|
||||
.B never
|
||||
screen does not show the caption even in split screen mode. The
|
||||
default is
|
||||
.BR splitonly .
|
||||
.P
|
||||
The second form changes the text used for the caption. You can use
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -2890,14 +2890,31 @@ int key;
|
||||
OutputMsg(0, "messages displayed on %s", use_hardstatus ? "hardstatus line" : "window");
|
||||
break;
|
||||
case RC_CAPTION:
|
||||
if (strcmp(args[0], "always") == 0 || strcmp(args[0], "splitonly") == 0)
|
||||
if (strcmp(args[0], "always") == 0 || strcmp(args[0], "splitonly") == 0 || strcmp(args[0], "never") == 0)
|
||||
{
|
||||
struct display *olddisplay = display;
|
||||
|
||||
captionalways = args[0][0] == 'a';
|
||||
switch (args[0][0])
|
||||
{
|
||||
case 'a':
|
||||
captionalways = CAPTION_ALWAYS;
|
||||
break;
|
||||
case 'n':
|
||||
captionalways = CAPTION_NEVER;
|
||||
break;
|
||||
default:
|
||||
captionalways = CAPTION_SPLITONLY;
|
||||
break;
|
||||
}
|
||||
for (display = displays; display; display = display->d_next)
|
||||
ChangeScreenSize(D_width, D_height, 1);
|
||||
display = olddisplay;
|
||||
if (args[0][0] == 'n')
|
||||
{
|
||||
if (args[1])
|
||||
Msg(0, "caption string not changed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp(args[0], "string") == 0)
|
||||
{
|
||||
@@ -5730,7 +5747,7 @@ char *data; /* dummy */
|
||||
|
||||
/* Showing a message when there's no hardstatus or caption cancels the input */
|
||||
if (display &&
|
||||
(captionalways || D_has_hstatus == HSTATUS_LASTLINE || (D_canvas.c_slperp && D_canvas.c_slperp->c_slnext)))
|
||||
(captionalways == CAPTION_ALWAYS || D_has_hstatus == HSTATUS_LASTLINE || (captionalways == CAPTION_SPLITONLY && D_canvas.c_slperp && D_canvas.c_slperp->c_slnext)))
|
||||
showmessage = 1;
|
||||
|
||||
while (l <= r)
|
||||
|
||||
@@ -159,7 +159,7 @@ int change_fore;
|
||||
|
||||
cv = &D_canvas;
|
||||
cv->c_xe = wi - 1;
|
||||
cv->c_ye = he - 1 - ((cv->c_slperp && cv->c_slperp->c_slnext) || captionalways) - (D_has_hstatus == HSTATUS_LASTLINE);
|
||||
cv->c_ye = he - 1 - ((captionalways == CAPTION_SPLITONLY && cv->c_slperp && cv->c_slperp->c_slnext) || captionalways == CAPTION_ALWAYS) - (D_has_hstatus == HSTATUS_LASTLINE);
|
||||
cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1;
|
||||
if (cv->c_slperp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user