shivamdixit/WebGoatPHP

Source code not properly indented in ACE editor

Closed this issue · 3 comments

When displaying source code to the user, it is not indented because we are using "trim" function and hence all the white-spaces are removed. If we will not use this function, it will show extra white-spaces, extra new lines.

We need something to remove extra spaces but at the same time keep indentation intact.

remove the minimum amount of whitespaces that all lines have? that would be a possible solution!

On Aug 16, 2014, at 12:13 AM, Shivam Dixit notifications@github.com wrote:

When displaying source code to the user, it is not indented because we are using "trim" function and hence all the white-spaces are removed. If we will not use this function, it will show extra white-spaces, extra new lines.

We need something to remove extra spaces but at the same time keep indentation intact.


Reply to this email directly or view it on GitHub.

just use rtrim instead to remove whitespace from the right end?

Simply using rtrim won't help. However a mix of rtrim and removing min amount of indent spaces that all lines have, solves the problem.

Using rtrim only:
rtrim

Using both:
ans

Thanks
Shivam