From 701e357d878136c0711d635ae00d1e3232be6378 Mon Sep 17 00:00:00 2001 From: vishalxl <> Date: Sun, 7 Aug 2022 20:41:48 +0530 Subject: [PATCH] improved content right shift logic --- lib/nostr_console_ds.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/nostr_console_ds.dart b/lib/nostr_console_ds.dart index 983aa74..4447937 100644 --- a/lib/nostr_console_ds.dart +++ b/lib/nostr_console_ds.dart @@ -31,13 +31,14 @@ String rightShiftContent(String s, int numSpaces) { for(int i = 0; i < s.length; i++) { if( s[i] == '\n') { - newlineCounter = 0; newString += "\n"; newString += spacesString; + newlineCounter = 0; } else { - if( newlineCounter == (screenWidth - numSpaces)) { + if( newlineCounter >= (screenWidth - numSpaces)) { newString += "\n"; newString += spacesString; + newlineCounter = 0; } newString += s[i];