@@ -90,7 +90,7 @@ function textFormatAsScript pScript, pIndentation, pUseTabs, pMarginInBlankLines
90
90
put empty into tFormatArray["handler-indentation"]
91
91
put 0 into tFormatArray["num-indent"]
92
92
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"]
94
94
put char 1 to trunc(tFormatArray["indentation"] / 2) of tFormatArray["indentation-chars"] into tFormatArray["else-space"]
95
95
put false into tFormatArray["continue-in-other-line"]
96
96
put false into tFormatArray["other-line"]
@@ -244,17 +244,40 @@ end _itemClearExtraSpaces
244
244
245
245
246
246
private 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
248
251
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
250
256
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
252
258
253
259
put false into pCommentML
254
260
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
256
266
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
258
281
end if
259
282
260
283
return pLine
0 commit comments