minor improvement in re alignment logic

This commit is contained in:
vishalxl 2022-08-18 19:09:20 +05:30
parent 52b52cfe05
commit bf734a3d92

View File

@ -98,6 +98,11 @@ Future<void> terminalMenuUi(Tree node, var contactList) async {
//gDebug = 1;
bool userContinue = true;
while(userContinue) {
// align the text again in case the window size has been changed
if( gAlignment == "center") {
gNumLeftMarginSpaces = (stdout.terminalColumns - gTextWidth )~/2;
}
// need a bit of wait to give other events to execute, so do a delay, which allows
// relays to recieve and handle new events
const int waitMilliSeconds = 400;
@ -122,11 +127,6 @@ Future<void> terminalMenuUi(Tree node, var contactList) async {
print('You picked: $option');
switch(option) {
case 1:
// align the text again in case the window size has been changed
if( gAlignment == "center") {
gNumLeftMarginSpaces = (stdout.terminalColumns - gTextWidth )~/2;
}
node.printTree(0, true, DateTime.now().subtract(Duration(days:numLastDays)));
break;
@ -206,7 +206,7 @@ Future<void> main(List<String> arguments) async {
}
}
// can be computed only after screenWidth has been found
// can be computed only after textWidth has been found
gNumLeftMarginSpaces = (stdout.terminalColumns - gTextWidth )~/2;
// undo above if left option is given