Bug 126480

Summary: Comments are cut short when generating PHP code
Product: [Applications] umbrello Reporter: James <james>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.5.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description James 2006-04-29 19:53:05 UTC
Version:           1.5.2 (using KDE 3.5.2, Gentoo)
Compiler:          gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.16-gentoo-r1

When generating PHP code (not PHP5) any documentation added for an operation in the Class Diagram is cut short to one line in the generated code.

As an example, I have the following documentation added to an operation in my Class Diagram:

"Performs a text search on the project data. 'project_list' now contains the MySQL results, or the function returns 0 if it fails."

However the generated PHP looks like this:

/**
 * Performs a text search on the project data. 'project_list' now contains the MySQL
 *
 * @return int
 * @access public
 */
Comment 1 Oliver Kellogg 2006-04-30 17:13:54 UTC
SVN commit 535830 by okellogg:

formatDoc(): Append remaining input line to `output' in the loop for splitting
up long lines. Note that this fix applies not only to the PHPWriter but to
all "old" code generators.
BUG:126480


 M  +1 -0      ChangeLog  
 M  +4 -2      umbrello/codegenerator.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #535829:535830
@@ -11,6 +11,7 @@
 * Memory problem when importing classes from c++ sources (122668)
 * Nestable components and subsystems in Component diagram (124326)
 * User interaction with UMLWidget improvements (126391)
+* Comments are cut short when generating PHP code (126480)
 
 Version 1.5.2
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerator.cpp #535829:535830
@@ -684,9 +684,11 @@
         }
         int index;
         do {
-            index = input.findRev(" ", lineWidth + 1);
-            if (index == -1)
+            index = input.findRev(" ", lineWidth);
+            if (index == -1) {
+                output += linePrefix + input + endLine;
                 break;
+            }
             output += linePrefix + input.left(index) + endLine; // add line
             input.remove(0, index + 1); //and remove processed string, including
             // white space