diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2001-02-11 18:24:41 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2001-02-11 18:24:41 (GMT) |
commit | d27070014e0f36246e7eec3899c7d55503b1a05a (patch) | |
tree | f98b164f024c28a0d6378b68142ed268239dba97 /src/definition.cpp | |
parent | f376c26e3dbe33a773a2f424df4b9c62c8c880ef (diff) | |
download | Doxygen-d27070014e0f36246e7eec3899c7d55503b1a05a.zip Doxygen-d27070014e0f36246e7eec3899c7d55503b1a05a.tar.gz Doxygen-d27070014e0f36246e7eec3899c7d55503b1a05a.tar.bz2 |
Release-1.2.5-20010211
Diffstat (limited to 'src/definition.cpp')
-rw-r--r-- | src/definition.cpp | 28 |
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; } } |