diff options
-rw-r--r-- | src/display.c | 16 | ||||
-rw-r--r-- | src/display.h | 4 | ||||
-rw-r--r-- | src/doc/screen.1 | 9 | ||||
-rw-r--r-- | src/process.c | 23 | ||||
-rw-r--r-- | src/resize.c | 2 |
5 files changed, 41 insertions, 13 deletions
diff --git a/src/display.c b/src/display.c index 2b3eca3..53422e1 100644 --- a/src/display.c +++ b/src/display.c @@ -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 */ - diff --git a/src/display.h b/src/display.h index e8b3b80..edee086 100644 --- a/src/display.h +++ b/src/display.h @@ -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 */ diff --git a/src/doc/screen.1 b/src/doc/screen.1 index c175891..4cd6dc4 100644 --- a/src/doc/screen.1 +++ b/src/doc/screen.1 @@ -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 diff --git a/src/process.c b/src/process.c index da9188d..d6e948f 100644 --- a/src/process.c +++ b/src/process.c @@ -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) diff --git a/src/resize.c b/src/resize.c index 61e044f..c091fab 100644 --- a/src/resize.c +++ b/src/resize.c @@ -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) { |