Skip to content

Commit 213e2d4

Browse files
committed
solve duplicate blank line
1 parent ac5d9f8 commit 213e2d4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

info.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,11 @@ void ComplexInfo::construct() {
148148
return;
149149
}
150150
beg = fsb->getContent().length();
151-
fsb->getContent() += "\n*" + itemName + "* {\n\n}\n";
151+
char c = fsb->getContent()[fsb->getContent().length() - 1];
152+
if (c != '\n' && c != '\r') {
153+
fsb->getContent() += '\n';
154+
}
155+
fsb->getContent() += "*" + itemName + "* {\n\n}\n";
152156
}
153157
int pos1 = fsb->getContent().find('{', beg) + 1;
154158
int pos2 = fsb->getContent().find('}', pos1) - 1;
@@ -173,6 +177,7 @@ void ComplexInfo::destruct() {
173177
for (; fsb->getContent()[lp] != '*'; --lp);
174178
for (--lp; fsb->getContent()[lp] != '*'; --lp);
175179
for (; fsb->getContent()[rp] != '}'; ++rp);
180+
for (; rp + 1 < fsb->getContent().length() && fsb->getContent()[rp + 1] <= 32; ++rp);
176181
fsb->getContent().erase(lp, rp - lp + 1);
177182
}
178183
}

0 commit comments

Comments
 (0)