Hi list, I sent this patch to Sadrul directly a little while back, but didn't hear anything back, so I figured I'd send to the list for feedback and hopefully acceptance. Note: the somewhat confusingly-named "horizontal" splits in screen refer to splitting a window into horizontally-adjacent windows, which I'm used to referring to as *vertical* splits, and I don't think I'm alone on that one. :)

Please accept the attached patch that adds the following:

Horizontal split extras

* Adds screen.exe to src/.gitignore
* Adds hsplitchar and hsplitcolor commands & processing
* Adds application of hsplitchar and hsplitcolor to drawing of horizontal
  split separator
* Adds documentation to doc/screen.1 and doc/screen.texinfo
* Adds example to etc/screenrc

Rather than use the defaults of a space character and the standout rendition when drawing the vertical separator between horizontally-split windows, these commands allow the user to customize its appearance.

It still preserves the default values prior to this patch, and the only regression I see is that if a user does change sorendition for the purpose of controlling the vertical bar's attributes/color, those will no longer be applied to that bar. I don't see a simple solution to this issue, but maybe you do. The remedy for such a user is to use the hsplitcolor command instead of, or in addition to, sorendition (or rendition so).

- Jim
diff --git src/.gitignore src/.gitignore
index 529960c..1549ed3 100644
--- src/.gitignore
+++ src/.gitignore
@@ -17,5 +17,6 @@ kmapdef.c
 osdef.h
 term.h
 screen
+screen.exe
 stamp-h.in
 tty.c
diff --git src/ansi.c src/ansi.c
index 04c9012..7c396b0 100644
--- src/ansi.c
+++ src/ansi.c
@@ -37,6 +37,7 @@
 #include "braille.h"
 #include "extern.h"
 #include "logfile.h"
+#include "window.h"
 
 extern struct display *display, *displays;
 extern struct win *fore;       /* for 83 escape */
@@ -77,6 +78,7 @@ struct mline mline_null;
 struct mchar mchar_null;
 struct mchar mchar_blank = {' ' /* , 0, 0, ... */};
 struct mchar mchar_so    = {' ', A_SO /* , 0, 0, ... */};
+struct mchar mchar_hs    = {' ', A_SO /* , 0, 0, ... */};
 
 int renditions[NUM_RENDS] = {65529 /* =ub */, 65531 /* =b */, 65533 /* =u */ };
 
diff --git src/comm.c src/comm.c
index 5f4af8a..f129cfb 100644
--- src/comm.c
+++ src/comm.c
@@ -204,6 +204,8 @@ struct comm comms[RC_LAST + 1] =
 #ifdef COPY_PASTE
   { "history",         NEED_DISPLAY|NEED_FORE|ARGS_0 },
 #endif
+  { "hsplitchar",              ARGS_01 },
+  { "hsplitcolor",  ARGS_012 },
   { "hstatus",         NEED_FORE|ARGS_1 },
   { "idle",            ARGS_0|ARGS_ORMORE },
   { "ignorecase",      ARGS_01 },
diff --git src/display.c src/display.c
index 61fff7d..562e072 100644
--- src/display.c
+++ src/display.c
@@ -76,14 +76,14 @@ extern int  MsgWait, MsgMinWait;
 extern int  Z0width, Z1width;
 extern unsigned char *blank, *null;
 extern struct mline mline_blank, mline_null, mline_old;
-extern struct mchar mchar_null, mchar_blank, mchar_so;
+extern struct mchar mchar_null, mchar_blank, mchar_so, mchar_hs;
 extern struct NewWindow nwin_default;
 extern struct action idleaction;
 
 /* XXX shouldn't be here */
 extern char *hstatusstring;
 extern char *captionstring;
-
+extern char hsplitchar;
 extern int pastefont;
 extern int idletimo;
 
@@ -2375,8 +2375,8 @@ int y, from, to, isblank;
          if (from == cv->c_xe + 1 && y >= cv->c_ys && y <= cv->c_ye + 1)
            {
              GotoPos(from, y);
-             SetRendition(&mchar_so);
-             PUTCHARLP(' ');
+             SetRendition(&mchar_hs);
+             PUTCHARLP(hsplitchar);
              from++;
              break;
            }
diff --git src/doc/screen.1 src/doc/screen.1
index 98674eb..19e650b 100644
--- src/doc/screen.1
+++ src/doc/screen.1
@@ -4,6 +4,7 @@
 .if n .ds U \&"
 .if t .ds Q ``
 .if t .ds U ''
+.ds nb ' '
 .UC 4
 .SH NAME
 screen \- screen manager with VT100/ANSI terminal emulation
@@ -2163,6 +2164,31 @@ tries to find a previous line that matches with the 
`prompt character'
 to the left of the cursor. This line is pasted into this window's input queue.
 Thus you have a crude command history (made up by the visible window and its
 scrollback buffer). 
+
+.sp
+.ne 3
+.B "hsplitchar "
+.RI [ \fIchar ]
+.PP
+Change the character that
+.I screen
+uses to render the vertical line between horizontally-split windows to
+\fIchar\fP (default:\ '\ ').  If no arguments are given, the current setting is
+displayed.
+
+.sp
+.ne 3
+.B "hsplitcolor "
+.RI [ attr
+.RI [ color ]]
+.PP
+Change the way
+.I screen
+renders the vertical line between horizontally-split windows. See the \*QSTRING
+ESCAPES\*U chapter for the syntax of the modifiers.  The default is currently
+\*Q=s\*U (standout, active colors).  If no arguments are given, the current
+settings are displayed.
+
 .sp
 .ne 3
 .BI "hstatus " status
diff --git src/doc/screen.texinfo src/doc/screen.texinfo
index d721647..db120a2 100644
--- src/doc/screen.texinfo
+++ src/doc/screen.texinfo
@@ -1023,6 +1023,10 @@ Set display height.  @xref{Window Size}.
 Display current key bindings.  @xref{Help}.
 @item history
 Find previous command beginning @dots{}.  @xref{History}.
+@item hsplitchar [@var{char}]
+Change the character drawn for vertical bars between horiz splits.  
@xref{Hsplitchar}.
+@item hsplitcolor [@var{attr} [@var{color}]]
+Change attributes/color used for vertical bars between horiz splits..  
@xref{Hsplitcolor}.
 @item hstatus @var{status}
 Change the window's hardstatus line.  @xref{Hardstatus}.
 @item idle [@var{timeout} [@var{cmd} @var{args}]]
@@ -2663,7 +2667,7 @@ Per default the hardstatus line of new windows is empty.
 Changes the current window's hardstatus line to @var{status}.
 @end deffn
 
-@node Mousetrack, , Hardstatus, Miscellaneous
+@node Mousetrack, Hsplitchar, Hardstatus, Miscellaneous
 @section Mousetrack
 
 @deffn Command mousetrack [ @code{on|off} ]
@@ -2682,6 +2686,26 @@ This command determines the default state of the 
@code{mousetrack}
 command, currently defaulting of @var{off}.
 @end deffn
 
+@node Hsplitchar, Hsplitcolor, Mousetrack, Miscellaneous
+@section Hsplitchar
+
+@deffn Command hsplitchar [ @code{char} ]
+(none)@*
+This command sets or displays the character that @code{screen} uses when
+drawing the vertical bar between horizontally-split windows.  The default value
+is a space character. 
+@end deffn
+
+@node Hsplitcolor, , Hsplitchar, Miscellaneous
+@section Hsplitcolor
+
+@deffn Command hsplitcolor [ @code{attr} [ @code{color} ] ]
+(none)@*
+This command sets or displays the attributes/color that @code{screen} uses when
+drawing the vertical bar between horizontally-split windows.  The default value
+is the standout attribute and current colors.
+@end deffn
+
 @node Virtual Terminal, Copy and Paste, Window Settings, Top
 @chapter Virtual Terminal
 
@@ -5040,6 +5064,8 @@ categories.
 * Screen Saver::               Define a screen safer.
 * Zmodem::                     Define how screen treats zmodem requests.
 * Mousetrack::                 Set whether screen should track mouse events.
+* Hsplitchar::                 Set the character drawn for horizontal splits.
+* Hsplitcolor::                        Set the attributes/color for horizontal 
splits.
 @end menu
 
 @node At, Break,  , Miscellaneous
diff --git src/etc/screenrc src/etc/screenrc
index ca6561d..4189a1d 100644
--- src/etc/screenrc
+++ src/etc/screenrc
@@ -151,3 +151,7 @@ bind ^] paste [.]
 # defnonblock 1
 # blankerprg rain -d 100
 # idle 30 blanker
+
+# Control appearance of the vertical line drawn for horizontal splits
+# hsplitchar '|'
+# hsplitcolor "= yk"
diff --git src/process.c src/process.c
index 30497a3..bfd00b8 100644
--- src/process.c
+++ src/process.c
@@ -57,6 +57,7 @@
 #include "list_generic.h"
 
 extern struct comm comms[];
+extern char hsplitchar;
 extern char *rc_name;
 extern char *RcFileName, *home;
 extern char *BellString, *ActivityString, *ShellProg, *ShellArgs[];
@@ -113,7 +114,7 @@ extern char *kmapdef[];
 extern char *kmapadef[];
 extern char *kmapmdef[];
 #endif
-extern struct mchar mchar_so, mchar_null;
+extern struct mchar mchar_so, mchar_null, mchar_hs;
 extern int renditions[];
 extern int VerboseCreate;
 #ifdef UTF8
@@ -1380,6 +1381,43 @@ int key;
       break;
 # endif
 #endif
+
+    case RC_HSPLITCHAR:
+      if (*args)
+      {
+        if (*argl != 1) {
+          OutputMsg(0, "%s: only a single character allowed", comms[nr].name);
+          break;
+        }
+        hsplitchar = **args;
+        Activate(-1);
+      } else {
+        OutputMsg(0, "%s is set to '%c'", comms[nr].name, hsplitchar);
+      }
+      break;
+
+    case RC_HSPLITCOLOR:
+      if (*args)
+      {
+        i = 0;
+        i = ParseAttrColor(*args, args[1], 1);
+        if (i == -1)
+          break;
+        ApplyAttrColor(i, &mchar_hs);
+        Activate(-1);
+        debug2("--> %x %x\n", mchar_hs.attr, mchar_hs.color);
+      } else {
+#ifdef COLOR
+        OutputMsg(0, "%s: attr 0x%02x  color 0x%02x",
+                  comms[nr].name, (unsigned char)mchar_hs.attr,
+                  (0x99 ^ (unsigned char)mchar_hs.color));
+#else
+        OutputMsg(0, "%s: attr 0x%02x",
+                  comms[nr].name, (unsigned char)mchar_hs.attr);
+#endif
+      }
+      break;
+
     case RC_DEBUG:
 #ifdef DEBUG
       if (!*args)
diff --git src/screen.c src/screen.c
index 6e19732..e30c6b0 100644
--- src/screen.c
+++ src/screen.c
@@ -203,6 +203,7 @@ char *BufferFile;
 char *PowDetachString;
 #endif
 char *hstatusstring;
+char hsplitchar;
 char *captionstring;
 char *timestring;
 char *wliststr;
@@ -462,7 +463,7 @@ char **av;
 #ifdef NAME_MAX
   debug1("NAME_MAX = %d\n", NAME_MAX);
 #endif
-
+  hsplitchar = ' ';
   BellString = SaveStr("Bell in window %n");
   VisualBellString = SaveStr("   Wuff,  Wuff!!  ");
   ActivityString = SaveStr("Activity in window %n");

Reply via email to