top: add a visual separator to lines printed 2 abreast
When the '4' toggle is on, and Summary Area %Cpu lines are shown two abreast, it's not always clear where the separation is between the two processors. So with this patch we'll now print a vertical bar separator between them (looking similar to the existing field headings). We will also reduce that 'GRAPH_suffix' constant to 1, reflecting the the trailing ']' bracket only, so as to maximize top's exploitation of available screen width. [ plus a superfluous double '+ +' has now been fixed ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
		
							
								
								
									
										11
									
								
								top/top.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								top/top.c
									
									
									
									
									
								
							@@ -224,7 +224,7 @@ static int Numa_node_sel = -1;
 | 
			
		||||
           commands -- which are now both 4-way toggles */
 | 
			
		||||
#define GRAPH_prefix  25     // beginning text + opening '['
 | 
			
		||||
#define GRAPH_actual  100    // the actual bars or blocks
 | 
			
		||||
#define GRAPH_suffix  2      // ending ']' + trailing space
 | 
			
		||||
#define GRAPH_suffix  1      // ending ']'
 | 
			
		||||
static float Graph_adj;      // bars/blocks scaling factor
 | 
			
		||||
static int   Graph_len;      // scaled length (<= GRAPH_actual)
 | 
			
		||||
static const char Graph_blks[] = "                                                                                                    ";
 | 
			
		||||
@@ -239,8 +239,13 @@ static const char Osel_filterO_fmt[] = "\ttype=%d,\t" OSEL_FILTER "%s\n";
 | 
			
		||||
static const char Osel_filterI_fmt[] = "\ttype=%d,\t" OSEL_FILTER "%*s\n";
 | 
			
		||||
 | 
			
		||||
        /* Support for 2 abreast Cpu display (if terminal is wide enough) */
 | 
			
		||||
static char Double_sp[] =  "     ";
 | 
			
		||||
#ifdef TOG4_OFF_SEP
 | 
			
		||||
static char Double_sp[] =  "   ";
 | 
			
		||||
#define DOUBLE_space  (sizeof(Double_sp) - 1)
 | 
			
		||||
#else
 | 
			
		||||
static char Double_sp[] =  " ~1 ~6 ";
 | 
			
		||||
#define DOUBLE_space  (sizeof(Double_sp) - 5)    // 1 for null, 4 unprintable
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef TOG4_NOTRUNC
 | 
			
		||||
 #define DOUBLE_limit  (160 + DOUBLE_space)
 | 
			
		||||
#else
 | 
			
		||||
@@ -1968,7 +1973,7 @@ static void adj_geometry (void) {
 | 
			
		||||
   else Graph_len = 80 - GRAPH_prefix - GRAPH_suffix;
 | 
			
		||||
   if (Screen_cols < DOUBLE_limit) Curwin->rc.double_up = 0;
 | 
			
		||||
   if (Curwin->rc.double_up) {
 | 
			
		||||
      Graph_len = (Screen_cols - DOUBLE_space - (2 * (GRAPH_prefix + + GRAPH_suffix))) / 2;
 | 
			
		||||
      Graph_len = (Screen_cols - DOUBLE_space - (2 * (GRAPH_prefix + GRAPH_suffix))) / 2;
 | 
			
		||||
      if (Graph_len > GRAPH_actual) Graph_len = GRAPH_actual;
 | 
			
		||||
   }
 | 
			
		||||
   Graph_adj = (float)Graph_len / 100.0;
 | 
			
		||||
 
 | 
			
		||||
@@ -56,6 +56,7 @@
 | 
			
		||||
//#define TERMIOS_ONLY            /* just limp along with native input only  */
 | 
			
		||||
//#define TOG4_NOFORCE            /* no force 2 abreast mode with '4' toggle */
 | 
			
		||||
//#define TOG4_NOTRUNC            /* ensure no truncation in 2 abreast mode  */
 | 
			
		||||
//#define TOG4_OFF_SEP            /* don't show two abreast visual separator */
 | 
			
		||||
//#define TREE_FOCUS_X            /* 'F' resets forest view indentation to 0 */
 | 
			
		||||
//#define TREE_NORESET            /* sort keys do NOT force forest view OFF  */
 | 
			
		||||
//#define TREE_SCANALL            /* rescan array w/ forest view, avoid sort */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user