@@ -90,7 +90,7 @@ function textFormatAsScript pScript, pIndentation, pUseTabs, pMarginInBlankLines
9090 put empty into tFormatArray["handler-indentation"]
9191 put 0 into tFormatArray["num-indent"]
9292 put false into tFormatArray["breakpoint"]
93- put char 1 to (tFormatArray["indentation"] * 2 ) of tFormatArray["indentation-chars"] into tFormatArray["other-line-space"]
93+ put char 1 to (tFormatArray["indentation"] ) of tFormatArray["indentation-chars"] into tFormatArray["other-line-space"]
9494 put char 1 to trunc(tFormatArray["indentation"] / 2) of tFormatArray["indentation-chars"] into tFormatArray["else-space"]
9595 put false into tFormatArray["continue-in-other-line"]
9696 put false into tFormatArray["other-line"]
@@ -244,17 +244,40 @@ end _itemClearExtraSpaces
244244
245245
246246private function _comments pLine, @pCommentML
247- local tEndCML, tResult
247+ /* If not in a multi-comment block abort */
248+ if not pCommentML then
249+ return pLine
250+ end if
248251
249- if pCommentML is true and "*/" is in pLine then
252+ /* Compute if this is the closure line */
253+ if "*/" is in pLine then
254+ local tResult
255+ local tEndCML
250256 put offset("*/", pLine) + 1 into tEndCML
251- put the char 1 to tEndCML of pLine into tResult
257+ put char 1 to tEndCML of pLine into tResult
252258
253259 put false into pCommentML
254260 add 1 to tEndCML
255- put space & _lineClearExtraSpaces(the char tEndCML to - 1 of pLine, pCommentML) after tResult
261+ put space & _lineClearExtraSpaces( \
262+ the char tEndCML to - 1 of pLine, \
263+ pCommentML) after tResult
264+ put tResult into pLine
265+ end if
256266
257- return tResult
267+ if "/*" is not in pLine then
268+ /* Ensure multiline middle lines begins with a '*' */
269+ if char 1 of pLine is not "*" then
270+ put "* " before pLine
271+ end if
272+ put space before pLine
273+ else
274+ /* Format the beginning of the block */
275+ local tOffset
276+ put offset("/*",pLine) into tOffset
277+
278+ if char (tOffset + 1) of pLine is not in (space,"*") then
279+ put space after char (tOffset + 1) of pLine
280+ end if
258281 end if
259282
260283 return pLine
0 commit comments