Page 1 of 1

Format indentation should remove blank space on end of lines

Posted: Sat May 14, 2016 1:18 pm
by Sicro
It would be nice to see that the menu command "Edit => Format indentation" would also remove spaces at the end of each line of code.

Re: Format indentation should remove blank space on end of l

Posted: Sun May 15, 2016 3:44 am
by collectordave
+1

Re: Format indentation should remove blank space on end of l

Posted: Sun May 15, 2016 7:00 am
by Mohawk70
I've found that quirk to be quite annoying ... I agree. Although in my opinion it ranks
low on the list , below actual bug fixes.

Re: Format indentation should remove blank space on end of l

Posted: Sun May 15, 2016 6:40 pm
by #NULL
if you consider macros then spaces at the end of a line might not always be outside of a string (note the spaces in a()):

Code: Select all

Macro a()
  "x         
EndMacro
Macro b()
  x"
EndMacro
s.s = a() b()
Debug s
spaces at the beginning of the macro body are already ignored as indentation though (don't know right now if only for the first line).

Re: Format indentation should remove blank space on end of l

Posted: Mon May 16, 2016 8:14 am
by Dude
I agree with the above: this would break macros that rely on spaces. So, I vote no.

Re: Format indentation should remove blank space on end of l

Posted: Mon May 16, 2016 8:21 am
by Keya
maybe just don't apply the fix to lines within macros?
i like the suggestion - i dont know why but the PB IDE seems to add a lot of extra spaces after some lines for no reason (somewhat intermittently), which frustrates me a lot when im trying to quickly navigate to the end of a line (often) and have to waste time clicking over useless spaces i never added in the first place

Re: Format indentation should remove blank space on end of l

Posted: Mon May 16, 2016 8:26 am
by IdeasVacuum
Instead of "Edit => Format indentation" additionally removing spaces at the end of lines, let's have a separate command for that task.

Re: Format indentation should remove blank space on end of l

Posted: Sat Aug 31, 2019 10:49 pm
by Sicro
@#Null:
Is such code often in use?
There are certainly many programmers here who also use other text editors besides the PB-IDE. Some of them have possibly defaulted settings that remove trailing spaces.
IdeasVacuum wrote:Instead of "Edit => Format indentation" additionally removing spaces at the end of lines, let's have a separate command for that task.
That's okay for me, too.
Or replace the menu item with "Reformat code". You can then specify in the preferences what the menu item should do (adjust indentation, remove trailing spaces, etc.).

Re: Format indentation should remove blank space on end of l

Posted: Sun Sep 01, 2019 6:45 pm
by #NULL
Sicro wrote:@#Null:
Is such code often in use?
I don't think so, I've never seen or used it. But that the behavior of the program might change by such a modification is something that should be considered. It can also be avoided by using

Code: Select all

Macro a()
  "x         "+"
EndMacro

Re: Format indentation should remove blank space on end of l

Posted: Sun Sep 08, 2019 4:49 pm
by Sicro
#NULL wrote:But that the behavior of the program might change by such a modification is something that should be considered.
Yes, that's why I think the suggestion of @Keya to leave the trailing spaces/tabs within macro blocks untouched is a good compromise.