mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-04-18 00:31:13 +02:00
Minor thread realignment changes
This commit is contained in:
parent
e9d3a90765
commit
481b0b41b8
@ -370,7 +370,7 @@ class EventData {
|
||||
temp = temp + "$idDateLikes";
|
||||
}
|
||||
//temp = temp + " |$idDateLikes";
|
||||
String contentShifted = rightShiftContent( temp, gSpacesPerDepth * depth + effectiveNameFieldLen);
|
||||
String contentShifted = makeParagraphAtDepth( temp, gSpacesPerDepth * depth + effectiveNameFieldLen);
|
||||
|
||||
strToPrint += getStrInColor(contentShifted + "\n", commentColor);
|
||||
stdout.write(strToPrint);
|
||||
@ -429,14 +429,18 @@ class EventData {
|
||||
|
||||
String dateToPrint = strDate.padLeft(gSpacesPerDepth * timeWidthDepth).substring(0, gSpacesPerDepth * timeWidthDepth);
|
||||
|
||||
strToPrint = "${getDepthSpaces(depth)} $dateToPrint $nameToPrint: ";
|
||||
|
||||
// depth above + ( depth numberof spaces = 1) + (depth of time = 2) + (depth of name = 3)
|
||||
int contentDepth = depth + 2 + timeWidthDepth + nameWidthDepth;
|
||||
String contentShifted = rightShiftContent(tempEvaluatedContent==""?tempContent: tempEvaluatedContent, gSpacesPerDepth * contentDepth);
|
||||
strToPrint += contentShifted;
|
||||
String contentShifted = makeParagraphAtDepth(tempEvaluatedContent==""?tempContent: tempEvaluatedContent, gSpacesPerDepth * contentDepth);
|
||||
|
||||
//strToPrint += contentShifted;
|
||||
if( isNotification) {
|
||||
strToPrint = "$gNotificationColor$strToPrint$gColorEndMarker";
|
||||
strToPrint = "$gNotificationColor${getDepthSpaces(depth)} $dateToPrint $nameToPrint: $gNotificationColor" + contentShifted + gColorEndMarker;
|
||||
//strToPrint = "$gNotificationColor$strToPrint$gColorEndMarker";
|
||||
isNotification = false;
|
||||
} else {
|
||||
strToPrint = "${getDepthSpaces(depth)} $dateToPrint $nameToPrint: " + contentShifted;
|
||||
}
|
||||
return strToPrint;
|
||||
}
|
||||
@ -805,7 +809,9 @@ String getNumDashes(int num, [String dashType = "-"]) {
|
||||
return s;
|
||||
}
|
||||
|
||||
String rightShiftContent(String s, int numSpaces) {
|
||||
// make a paragraph of s that starts at numSpaces ( from screen left), and does not extend beyond gTextWidth+gNumLeftMarginSpaces. break it, or add
|
||||
// a newline if it goes beyond gTextWidth + gNumLeftMarginSpaces
|
||||
String makeParagraphAtDepth(String s, int numSpaces) {
|
||||
String newString = "";
|
||||
int numCharsInCurLine = 0;
|
||||
String spacesString = getNumSpaces(numSpaces + gNumLeftMarginSpaces);
|
||||
@ -842,7 +848,7 @@ String rightShiftContent(String s, int numSpaces) {
|
||||
newString += spacesString;
|
||||
numCharsInCurLine = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
newString += s[i];
|
||||
}
|
||||
numCharsInCurLine++;
|
||||
|
@ -87,7 +87,7 @@ const String gDummyAccountPubkey = "Non";
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// UI and Color
|
||||
const int gMinValidTextWidth = 60; // minimum text width acceptable
|
||||
const int gDefaultTextWidth = 100; // default text width
|
||||
const int gDefaultTextWidth = 120; // default text width
|
||||
int gTextWidth = gDefaultTextWidth; // is changed by --width option
|
||||
const int gSpacesPerDepth = 4; // constant
|
||||
int gNumLeftMarginSpaces = 0;// this number is modified in main
|
||||
@ -98,9 +98,9 @@ const int gNameLengthInPost = 12;
|
||||
// after depth of maxDepthAllowed the thread is re-aligned to left by leftShiftThreadBy
|
||||
const int gMinimumDepthAllowed = 2;
|
||||
const int gMaximumDepthAllowed = 12;
|
||||
const int gDefaultMaxDepth = 4;
|
||||
const int gDefaultMaxDepth = 6;
|
||||
int maxDepthAllowed = gDefaultMaxDepth;
|
||||
const int leftShiftThreadsBy = 3;
|
||||
const int leftShiftThreadsBy = 4;
|
||||
|
||||
// https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#8-colors
|
||||
// Color related settings
|
||||
|
@ -264,7 +264,7 @@ class Tree {
|
||||
if( depth > maxDepthAllowed) {
|
||||
depth = maxDepthAllowed - leftShiftThreadsBy;
|
||||
printDepth(depth+1);
|
||||
stdout.write("┌${getNumDashes((leftShiftThreadsBy + 1) * gSpacesPerDepth - 1, "─")}┘");
|
||||
stdout.write(" ┌${getNumDashes((leftShiftThreadsBy + 1) * gSpacesPerDepth - 1, "─")}┘");
|
||||
leftShifted = true;
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ class Tree {
|
||||
if( leftShifted) {
|
||||
stdout.write("\n");
|
||||
printDepth(depth+1);
|
||||
print("┴");
|
||||
print(" ┴"); // same spaces as when its left shifted
|
||||
}
|
||||
|
||||
return numPrinted;
|
||||
|
Loading…
x
Reference in New Issue
Block a user