Browse Source

FLUID: avoid trailing spaces in empty comment lines (#1161)

pull/1167/head
Matthias Melcher 6 months ago
parent
commit
ead9078bc3
  1. 15
      fluid/Fl_Type.cxx

15
fluid/Fl_Type.cxx

@ -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();
if (*s && *s!='\n')
f.write_c("%s ", pre); 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 (*s && *s!='\n') {
if (pre) if (pre)
f.write_c("%s ", pre); f.write_c("%s ", pre);
else else
f.write_c("%s ", f.indent_plus(1)); 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!

Loading…
Cancel
Save