summaryrefslogtreecommitdiff
path: root/fluid/Fl_Type.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-12-09 21:53:09 +0100
committerMatthias Melcher <github@matthiasm.com>2024-12-09 21:53:32 +0100
commitead9078bc3a1bfc2a80bef4bfda2ff2fed7e5b4f (patch)
tree23260cb5f4f7ed00dcb3ac784b5152e72bb4eba2 /fluid/Fl_Type.cxx
parentfe8177ea2ce409702882cf40f9e9dbc435dd3d84 (diff)
FLUID: avoid trailing spaces in empty comment lines (#1161)
Diffstat (limited to 'fluid/Fl_Type.cxx')
-rw-r--r--fluid/Fl_Type.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx
index 6287e714f..071caaff4 100644
--- a/fluid/Fl_Type.cxx
+++ b/fluid/Fl_Type.cxx
@@ -1096,11 +1096,13 @@ void Fl_Type::write_comment_c(Fd_Code_Writer& f, const char *pre)
if (comment() && *comment()) {
f.write_c("%s/**\n", pre);
const char *s = comment();
- f.write_c("%s ", pre);
+ if (*s && *s!='\n')
+ f.write_c("%s ", pre);
while(*s) {
if (*s=='\n') {
- if (s[1]) {
- f.write_c("\n%s ", pre);
+ f.write_c("\n");
+ if (s[1] && s[1]!='\n') {
+ f.write_c("%s ", pre);
}
} else {
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));
} else {
f.write_c("%s/*\n", pre?pre:"");
- if (pre)
- f.write_c("%s ", pre);
- else
- f.write_c("%s ", f.indent_plus(1));
+ if (*s && *s!='\n') {
+ if (pre)
+ f.write_c("%s ", pre);
+ else
+ f.write_c("%s ", f.indent_plus(1));
+ }
while(*s) {
if (*s=='\n') {
- if (s[1]) {
+ f.write_c("\n");
+ if (s[1] && s[1]!='\n') {
if (pre)
- f.write_c("\n%s ", pre);
+ f.write_c("%s ", pre);
else
- f.write_c("\n%s ", f.indent_plus(1));
+ f.write_c("%s ", f.indent_plus(1));
}
} else {
f.write_c("%c", *s); // FIXME this is much too slow!