mirror of
https://github.com/vishalxl/nostr_console.git
synced 2025-12-01 00:07:16 +01:00
Minor thread realignment changes
This commit is contained in:
@@ -370,7 +370,7 @@ class EventData {
|
|||||||
temp = temp + "$idDateLikes";
|
temp = temp + "$idDateLikes";
|
||||||
}
|
}
|
||||||
//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);
|
strToPrint += getStrInColor(contentShifted + "\n", commentColor);
|
||||||
stdout.write(strToPrint);
|
stdout.write(strToPrint);
|
||||||
@@ -429,14 +429,18 @@ class EventData {
|
|||||||
|
|
||||||
String dateToPrint = strDate.padLeft(gSpacesPerDepth * timeWidthDepth).substring(0, gSpacesPerDepth * timeWidthDepth);
|
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)
|
// depth above + ( depth numberof spaces = 1) + (depth of time = 2) + (depth of name = 3)
|
||||||
int contentDepth = depth + 2 + timeWidthDepth + nameWidthDepth;
|
int contentDepth = depth + 2 + timeWidthDepth + nameWidthDepth;
|
||||||
String contentShifted = rightShiftContent(tempEvaluatedContent==""?tempContent: tempEvaluatedContent, gSpacesPerDepth * contentDepth);
|
String contentShifted = makeParagraphAtDepth(tempEvaluatedContent==""?tempContent: tempEvaluatedContent, gSpacesPerDepth * contentDepth);
|
||||||
strToPrint += contentShifted;
|
|
||||||
|
//strToPrint += contentShifted;
|
||||||
if( isNotification) {
|
if( isNotification) {
|
||||||
strToPrint = "$gNotificationColor$strToPrint$gColorEndMarker";
|
strToPrint = "$gNotificationColor${getDepthSpaces(depth)} $dateToPrint $nameToPrint: $gNotificationColor" + contentShifted + gColorEndMarker;
|
||||||
|
//strToPrint = "$gNotificationColor$strToPrint$gColorEndMarker";
|
||||||
isNotification = false;
|
isNotification = false;
|
||||||
|
} else {
|
||||||
|
strToPrint = "${getDepthSpaces(depth)} $dateToPrint $nameToPrint: " + contentShifted;
|
||||||
}
|
}
|
||||||
return strToPrint;
|
return strToPrint;
|
||||||
}
|
}
|
||||||
@@ -805,7 +809,9 @@ String getNumDashes(int num, [String dashType = "-"]) {
|
|||||||
return s;
|
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 = "";
|
String newString = "";
|
||||||
int numCharsInCurLine = 0;
|
int numCharsInCurLine = 0;
|
||||||
String spacesString = getNumSpaces(numSpaces + gNumLeftMarginSpaces);
|
String spacesString = getNumSpaces(numSpaces + gNumLeftMarginSpaces);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ const String gDummyAccountPubkey = "Non";
|
|||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// UI and Color
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// UI and Color
|
||||||
const int gMinValidTextWidth = 60; // minimum text width acceptable
|
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
|
int gTextWidth = gDefaultTextWidth; // is changed by --width option
|
||||||
const int gSpacesPerDepth = 4; // constant
|
const int gSpacesPerDepth = 4; // constant
|
||||||
int gNumLeftMarginSpaces = 0;// this number is modified in main
|
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
|
// after depth of maxDepthAllowed the thread is re-aligned to left by leftShiftThreadBy
|
||||||
const int gMinimumDepthAllowed = 2;
|
const int gMinimumDepthAllowed = 2;
|
||||||
const int gMaximumDepthAllowed = 12;
|
const int gMaximumDepthAllowed = 12;
|
||||||
const int gDefaultMaxDepth = 4;
|
const int gDefaultMaxDepth = 6;
|
||||||
int maxDepthAllowed = gDefaultMaxDepth;
|
int maxDepthAllowed = gDefaultMaxDepth;
|
||||||
const int leftShiftThreadsBy = 3;
|
const int leftShiftThreadsBy = 4;
|
||||||
|
|
||||||
// https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#8-colors
|
// https://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html#8-colors
|
||||||
// Color related settings
|
// Color related settings
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ class Tree {
|
|||||||
if( depth > maxDepthAllowed) {
|
if( depth > maxDepthAllowed) {
|
||||||
depth = maxDepthAllowed - leftShiftThreadsBy;
|
depth = maxDepthAllowed - leftShiftThreadsBy;
|
||||||
printDepth(depth+1);
|
printDepth(depth+1);
|
||||||
stdout.write("┌${getNumDashes((leftShiftThreadsBy + 1) * gSpacesPerDepth - 1, "─")}┘");
|
stdout.write(" ┌${getNumDashes((leftShiftThreadsBy + 1) * gSpacesPerDepth - 1, "─")}┘");
|
||||||
leftShifted = true;
|
leftShifted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,7 +274,7 @@ class Tree {
|
|||||||
if( leftShifted) {
|
if( leftShifted) {
|
||||||
stdout.write("\n");
|
stdout.write("\n");
|
||||||
printDepth(depth+1);
|
printDepth(depth+1);
|
||||||
print("┴");
|
print(" ┴"); // same spaces as when its left shifted
|
||||||
}
|
}
|
||||||
|
|
||||||
return numPrinted;
|
return numPrinted;
|
||||||
|
|||||||
Reference in New Issue
Block a user