mirror of
https://github.com/fltk/fltk.git
synced 2026-05-26 01:46:58 +08:00
FLUID: avoid trailing spaces in empty comment lines (#1161)
This commit is contained in:
+15
-10
@@ -1096,11 +1096,13 @@ void Fl_Type::write_comment_c(Fd_Code_Writer& f, const char *pre)
|
|||||||
if (comment() && *comment()) {
|
if (comment() && *comment()) {
|
||||||
f.write_c("%s/**\n", pre);
|
f.write_c("%s/**\n", pre);
|
||||||
const char *s = comment();
|
const char *s = comment();
|
||||||
f.write_c("%s ", pre);
|
if (*s && *s!='\n')
|
||||||
|
f.write_c("%s ", pre);
|
||||||
while(*s) {
|
while(*s) {
|
||||||
if (*s=='\n') {
|
if (*s=='\n') {
|
||||||
if (s[1]) {
|
f.write_c("\n");
|
||||||
f.write_c("\n%s ", pre);
|
if (s[1] && s[1]!='\n') {
|
||||||
|
f.write_c("%s ", pre);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
f.write_c("%c", *s); // FIXME this is much too slow!
|
f.write_c("%c", *s); // FIXME this is much too slow!
|
||||||
@@ -1125,17 +1127,20 @@ void Fl_Type::write_comment_inline_c(Fd_Code_Writer& f, const char *pre)
|
|||||||
if (!pre) f.write_c("%s", f.indent_plus(1));
|
if (!pre) f.write_c("%s", f.indent_plus(1));
|
||||||
} else {
|
} else {
|
||||||
f.write_c("%s/*\n", pre?pre:"");
|
f.write_c("%s/*\n", pre?pre:"");
|
||||||
if (pre)
|
if (*s && *s!='\n') {
|
||||||
f.write_c("%s ", pre);
|
if (pre)
|
||||||
else
|
f.write_c("%s ", pre);
|
||||||
f.write_c("%s ", f.indent_plus(1));
|
else
|
||||||
|
f.write_c("%s ", f.indent_plus(1));
|
||||||
|
}
|
||||||
while(*s) {
|
while(*s) {
|
||||||
if (*s=='\n') {
|
if (*s=='\n') {
|
||||||
if (s[1]) {
|
f.write_c("\n");
|
||||||
|
if (s[1] && s[1]!='\n') {
|
||||||
if (pre)
|
if (pre)
|
||||||
f.write_c("\n%s ", pre);
|
f.write_c("%s ", pre);
|
||||||
else
|
else
|
||||||
f.write_c("\n%s ", f.indent_plus(1));
|
f.write_c("%s ", f.indent_plus(1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
f.write_c("%c", *s); // FIXME this is much too slow!
|
f.write_c("%c", *s); // FIXME this is much too slow!
|
||||||
|
|||||||
Reference in New Issue
Block a user