davidvarga / MBeautifier

MBeautifier is a MATLAB source code formatter, beautifier. It can be used directly in the MATLAB Editor and it is configurable.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove trailing spaces on empty lines

danielmeer opened this issue · comments

Hi,

It would be great to have the option to remove all trailing white space. The MATLAB indentation function (Ctrl+i) already handles this for lines containing code, but it adds spaces on empty lines up to the current indentation level.

The current behavior is like this (I added dots to show the spaces):

for true
....
    a = 1;
....
end

And I would like this:

for true

    a = 1;

end

I think something like this regex should do the trick: regexprep(text, '^\s+$', '', 'lineanchors')

Hi,
it seems quite simple to be implemented - I'll take care in short time.
Thanks for the proposal.

Hi, I implemented it - in the evening I can push it. I made it default as it can lead to smaller file sizes.