File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed
OMEdit/OMEditGUI/Modeling Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -2170,7 +2170,37 @@ void LibraryTreeModel::readLibraryTreeItemClassTextFromText(LibraryTreeItem *pLi
21702170 } else if (lineNumber > pLibraryTreeItem->mClassInformation .lineNumberEnd ) {
21712171 after += currentLine + " \n " ;
21722172 } else if (pLibraryTreeItem->inRange (lineNumber)) {
2173- text += currentLine + " \n " ;
2173+ /* Ticket #4233
2174+ * We could have code like this,
2175+ *
2176+ * package P
2177+ * package Q
2178+ * model M1
2179+ * end M1;
2180+ *
2181+ * model M2
2182+ * end M2; end Q;
2183+ * end P;
2184+ *
2185+ * So we need to conside column start and end.
2186+ */
2187+ if (lineNumber == pLibraryTreeItem->mClassInformation .lineNumberStart ) {
2188+ QString leftStr = currentLine.left (pLibraryTreeItem->mClassInformation .columnNumberStart - 1 );
2189+ int nonSpaceIndex = TabSettings::firstNonSpace (leftStr);
2190+ /* If there is no other text on the first line of class then take the whole line.
2191+ */
2192+ if (nonSpaceIndex >= pLibraryTreeItem->mClassInformation .columnNumberStart - 1 ) {
2193+ text += currentLine + " \n " ;
2194+ } else {
2195+ before += currentLine.left (pLibraryTreeItem->mClassInformation .columnNumberStart - 1 );
2196+ text += currentLine.mid (pLibraryTreeItem->mClassInformation .columnNumberStart - 1 ) + " \n " ;
2197+ }
2198+ } else if (lineNumber == pLibraryTreeItem->mClassInformation .lineNumberEnd ) {
2199+ text += currentLine.left (pLibraryTreeItem->mClassInformation .columnNumberEnd );
2200+ after += currentLine.mid (pLibraryTreeItem->mClassInformation .columnNumberEnd ) + " \n " ;
2201+ } else {
2202+ text += currentLine + " \n " ;
2203+ }
21742204 }
21752205 lineNumber++;
21762206 }
You can’t perform that action at this time.
0 commit comments