|
@@ -406,12 +406,13 @@ namespace Usm.Cli {
|
|
|
* The bar zone proper — gap, fill cells, gap and the fraction's
|
|
* The bar zone proper — gap, fill cells, gap and the fraction's
|
|
|
* percentage right-aligned in a `100%`-wide field.
|
|
* percentage right-aligned in a `100%`-wide field.
|
|
|
*
|
|
*
|
|
|
- * When {@link colour} is provided (transaction bar), filled cells
|
|
|
|
|
- * render with identical foreground+background — a seamless solid
|
|
|
|
|
- * bar with no inter-character gaps — and the partial cell carries
|
|
|
|
|
- * a dim background so the bar's edge stays defined against the
|
|
|
|
|
- * empty cells (plain spaces). Phase bars pass null and render
|
|
|
|
|
- * partial-block characters on spaces.
|
|
|
|
|
|
|
+ * All interactive modes render the bar as a coloured track:
|
|
|
|
|
+ * full cells use identical foreground+background (a seamless
|
|
|
|
|
+ * solid bar with no inter-character gaps), the partial cell
|
|
|
|
|
+ * carries the bar colour on the dim track background, and empty
|
|
|
|
|
+ * cells are the dim track itself. The track is always visually
|
|
|
|
|
+ * defined. {@link colour} selects the fill (task colour, or
|
|
|
|
|
+ * bright white when null for phase bars).
|
|
|
*/
|
|
*/
|
|
|
private string bar_text(int bar_zone, float fraction, string? colour = null) {
|
|
private string bar_text(int bar_zone, float fraction, string? colour = null) {
|
|
|
var percent = (int)(fraction * 100);
|
|
var percent = (int)(fraction * 100);
|
|
@@ -436,30 +437,56 @@ namespace Usm.Cli {
|
|
|
|
|
|
|
|
var cells = new StringBuilder();
|
|
var cells = new StringBuilder();
|
|
|
cells.append(" ");
|
|
cells.append(" ");
|
|
|
- if(!unicode) {
|
|
|
|
|
- cells.append("[");
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- if(colour != null && unicode) {
|
|
|
|
|
- var bg = colour.replace("[3", "[4");
|
|
|
|
|
- cells.append(colour);
|
|
|
|
|
|
|
+ if(interactive && unicode) {
|
|
|
|
|
+ var fg = colour ?? "\x1b[97m";
|
|
|
|
|
+ var bg = fg.contains("[9") ? fg.replace("[9", "[10") : fg.replace("[3", "[4");
|
|
|
|
|
+ const string DIM_BG = "\x1b[100m";
|
|
|
|
|
+ const string RESET = "\x1b[0m";
|
|
|
|
|
+
|
|
|
|
|
+ cells.append(fg);
|
|
|
cells.append(bg);
|
|
cells.append(bg);
|
|
|
for(var i = 0; i < full; i++) {
|
|
for(var i = 0; i < full; i++) {
|
|
|
cells.append(" ");
|
|
cells.append(" ");
|
|
|
}
|
|
}
|
|
|
|
|
+ cells.append(RESET);
|
|
|
|
|
+ cells.append(DIM_BG);
|
|
|
if(full < capacity && eighths > 0) {
|
|
if(full < capacity && eighths > 0) {
|
|
|
- cells.append("\033[49m");
|
|
|
|
|
- cells.append(colour);
|
|
|
|
|
- cells.append("\033[100m");
|
|
|
|
|
|
|
+ cells.append(fg);
|
|
|
cells.append(partial_blocks[eighths]);
|
|
cells.append(partial_blocks[eighths]);
|
|
|
|
|
+ cells.append(RESET);
|
|
|
|
|
+ cells.append(DIM_BG);
|
|
|
full++;
|
|
full++;
|
|
|
}
|
|
}
|
|
|
- cells.append("\033[0m");
|
|
|
|
|
for(var i = full; i < capacity; i++) {
|
|
for(var i = full; i < capacity; i++) {
|
|
|
cells.append(" ");
|
|
cells.append(" ");
|
|
|
}
|
|
}
|
|
|
|
|
+ cells.append(RESET);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(interactive && !unicode) {
|
|
|
|
|
+ var fg = colour ?? "\x1b[97m";
|
|
|
|
|
+ var bg = fg.contains("[9") ? fg.replace("[9", "[10") : fg.replace("[3", "[4");
|
|
|
|
|
+ const string DIM_BG = "\x1b[100m";
|
|
|
|
|
+ const string RESET = "\x1b[0m";
|
|
|
|
|
+
|
|
|
|
|
+ cells.append("[");
|
|
|
|
|
+ cells.append(fg);
|
|
|
|
|
+ cells.append(bg);
|
|
|
|
|
+ for(var i = 0; i < full; i++) {
|
|
|
|
|
+ cells.append("#");
|
|
|
|
|
+ }
|
|
|
|
|
+ cells.append(RESET);
|
|
|
|
|
+ cells.append(DIM_BG);
|
|
|
|
|
+ for(var i = full; i < capacity; i++) {
|
|
|
|
|
+ cells.append(" ");
|
|
|
|
|
+ }
|
|
|
|
|
+ cells.append(RESET);
|
|
|
|
|
+ cells.append("]");
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
|
|
+ if(!unicode) {
|
|
|
|
|
+ cells.append("[");
|
|
|
|
|
+ }
|
|
|
for(var i = 0; i < full; i++) {
|
|
for(var i = 0; i < full; i++) {
|
|
|
cells.append(bar_filled_char);
|
|
cells.append(bar_filled_char);
|
|
|
}
|
|
}
|
|
@@ -470,11 +497,11 @@ namespace Usm.Cli {
|
|
|
for(var i = full; i < capacity; i++) {
|
|
for(var i = full; i < capacity; i++) {
|
|
|
cells.append(" ");
|
|
cells.append(" ");
|
|
|
}
|
|
}
|
|
|
|
|
+ if(!unicode) {
|
|
|
|
|
+ cells.append("]");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(!unicode) {
|
|
|
|
|
- cells.append("]");
|
|
|
|
|
- }
|
|
|
|
|
cells.append(" ");
|
|
cells.append(" ");
|
|
|
cells.append("%3d%%".printf(percent));
|
|
cells.append("%3d%%".printf(percent));
|
|
|
return cells.str;
|
|
return cells.str;
|