Using R2019B, I get the following when using the "format selection" functionality, if the selection starts anywhere in the first line of the editor window:
Undefined function or variable 'lineBeforePosition'.
Error in MBeautify.formatEditorSelection (line 137)
expandedSelection = [lineBeforePosition(1), 1, expandedSelection(3), Inf];
137 expandedSelection = [lineBeforePosition(1), 1, expandedSelection(3), Inf];
Using R2019B, I get the following when using the "format selection" functionality, if the selection starts anywhere in the first line of the editor window: