improved content right shift logic

This commit is contained in:
vishalxl 2022-08-07 20:41:48 +05:30
parent 1ac279d6d7
commit 701e357d87

View File

@ -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];