summaryrefslogtreecommitdiffstats
path: root/src/definition.cpp
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-02-11 18:24:41 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-02-11 18:24:41 (GMT)
commit863353b89b228b87789e6d6c9257605acd796fff (patch)
treef98b164f024c28a0d6378b68142ed268239dba97 /src/definition.cpp
parent1b90a1cf58b6b94d00e28d8212828956e8f9d177 (diff)
downloadDoxygen-863353b89b228b87789e6d6c9257605acd796fff.zip
Doxygen-863353b89b228b87789e6d6c9257605acd796fff.tar.gz
Doxygen-863353b89b228b87789e6d6c9257605acd796fff.tar.bz2
Release-1.2.5-20010211
Diffstat (limited to 'src/definition.cpp')
-rw-r--r--src/definition.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/definition.cpp b/src/definition.cpp
index b068d79..ebd126c 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -141,7 +141,7 @@ void Definition::setBriefDescription(const char *b)
}
/*! Reads a fragment of code from file \a fileName starting at
- * line \a startLine and ending at line \a endLine. The fragment is
+ * line \a startLine and ending at line \a endLine (inclusive). The fragment is
* stored in \a result. If FALSE is returned the code fragment could not be
* found.
*
@@ -201,10 +201,15 @@ static bool readCodeFragment(const char *fileName,
}
if (found)
{
- // fill the line with spaces until the right column
- QCString spaces;
- spaces.fill(' ',col);
- result+=spaces;
+ // For code with more than one line,
+ // fill the line with spaces until we are at the right column
+ // so that the opening brace lines up with the closing brace
+ if (endLine!=startLine)
+ {
+ QCString spaces;
+ spaces.fill(' ',col);
+ result+=spaces;
+ }
// copy until end of line
result+=c;
if (c==':') result+=cn;
@@ -221,15 +226,16 @@ static bool readCodeFragment(const char *fileName,
} while (size_read == (maxLineLength-1));
lineNr++;
- } while (lineNr<endLine && !f.atEnd());
+ } while (lineNr<=endLine && !f.atEnd());
- int charIndex = result.findRev('}');
- if (charIndex > 0)
+ // strip stuff after closing bracket
+ int newLineIndex = result.findRev('\n');
+ int braceIndex = result.findRev('}');
+ if (braceIndex > newLineIndex)
{
- result.truncate(charIndex+1);
- result+='\n';
+ result.truncate(braceIndex+1);
}
- endLine=lineNr;
+ endLine=lineNr-1;
return TRUE;
}
}