diff --git a/Toolset/palettes/script editor/behaviors/revsecommoneditorbehavior.livecodescript b/Toolset/palettes/script editor/behaviors/revsecommoneditorbehavior.livecodescript index f9eca8a84d..ee327a3e40 100644 --- a/Toolset/palettes/script editor/behaviors/revsecommoneditorbehavior.livecodescript +++ b/Toolset/palettes/script editor/behaviors/revsecommoneditorbehavior.livecodescript @@ -677,6 +677,9 @@ private function textFormatSelection pText put pText into tTextLines split tTextLines by return + local tLastCharIsReturn + put (char -1 of pText is return) into tLastCharIsReturn + get textFormatLine(1, tTextLines, tPreviousLine) put firstWordToEnd(tTextLines[1]) into tTextLines[1] put tTextLines[1] into tResult @@ -700,6 +703,10 @@ private function textFormatSelection pText put return & tTextLines[tIndex] after tResult end repeat + if char -1 of tResult is not return and tLastCharIsReturn then + put return after tResult + end if + if line -1 of pText = "" then put cr after tResult return tResult diff --git a/notes/bugfix-22636.md b/notes/bugfix-22636.md new file mode 100644 index 0000000000..cad77cf474 --- /dev/null +++ b/notes/bugfix-22636.md @@ -0,0 +1 @@ +# Assure textFormatSelection preserves returns at end of text