Bug 94524 - Add option to remove trailing spaces in the Basic IDE
Summary: Add option to remove trailing spaces in the Basic IDE
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: BASIC-IDE
  Show dependency treegraph
 
Reported: 2015-09-26 10:10 UTC by Óvári
Modified: 2022-12-16 09:50 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Óvári 2015-09-26 10:10:46 UTC
Enhancement suggestion for the LibreOffice IDE is to automatically remove any tailing whitespaces (eg spaces, tabs) at the end of each line.
Comment 1 Cor Nouws 2015-09-26 11:23:20 UTC
Thanks for splitting all up, Óvári!

Setting to new..
Comment 2 tagezi 2017-05-26 12:02:30 UTC
It need to decide when spaces and tabs have to be deleted during a work macros or saving it.
Also, it requires setting, because there are people who do not like it. So, dev have to create tab BasicIDE in Tool -> Options.
Comment 3 Rafael Lima 2022-12-06 20:40:33 UTC
We could have an option in the Edit menu named "Remove all trailing spaces". When the user clicks this command, it will remove all trailing spaces in the currently open module.

This way, we wouldn't need to create a new setting.
Comment 4 Heiko Tietze 2022-12-07 08:57:39 UTC
Calc nows the function TRIM() to remove trailing spaces. And probably some IDE too but in general it's not a common function. And not urgently needed.

I'd prefer to realize this special request per extension/macro.
Comment 5 Gerhard Weydt 2022-12-14 11:40:04 UTC
(In reply to Heiko Tietze from comment #4)
> Calc nows the function TRIM() to remove trailing spaces. And probably some
> IDE too but in general it's not a common function. And not urgently needed.
> 
> I'd prefer to realize this special request per extension/macro.

LibO Basic has this function, too, as well as LTRIM and RTRIM. But this handles string variables. In contrast, the request is, as far as I understand, to remove trailing blanks in the Basic Code, shown in the IDE.
I do not see much use in this feature, as the blanks do no harm.
Comment 6 Cor Nouws 2022-12-14 14:16:37 UTC
(In reply to Gerhard Weydt from comment #5)

> LibO Basic has this function, too, as well as LTRIM and RTRIM. But this
And Trim functions also remove leading spaces ;)

> handles string variables. In contrast, the request is, as far as I
> understand, to remove trailing blanks in the Basic Code, shown in the IDE.
Yep.

> I do not see much use in this feature, as the blanks do no harm.
This is one part of all suggestions done in/for 92251 by ÓVári. Just makes sense to have that for macro coders. And comment 3 gives a nice direction IMO.
Comment 7 Eyal Rozenberg 2022-12-14 19:31:04 UTC
(In reply to Heiko Tietze from comment #4)
> Calc nows the function TRIM() to remove trailing spaces. And probably some
> IDE too but in general it's not a common function.

I think it's fairly common as a voluntary or on-save action at least. Examples:

https://stackoverflow.com/questions/20679842/remove-trailing-whitespace-on-save-in-intellij-idea-12

https://stackoverflow.com/q/82971/1593077

https://stackoverflow.com/q/1043433/1593077

but I have no opinion about this bug. One might wonder... does it make sense for LO to maintain its own IDE, striving for a full set of IDE features? Or should it better delegate work to a separate IDE, which is likely to offer more code-editing-specific features than LO itself?
Comment 8 Heiko Tietze 2022-12-15 07:45:12 UTC
(In reply to Eyal Rozenberg from comment #7)
> Examples:

VC and Eclipse per extension/addon...
Comment 9 Rafael Lima 2022-12-15 22:49:22 UTC
In Kate it is a built-in feature:

https://kate-editor.org/2012/10/27/remove-trailing-spaces/

In PyCharm it is a built-in feature as well... every time you save the file it removes the trailing spaces.
Comment 10 Heiko Tietze 2022-12-16 08:02:34 UTC
We discussed the topic in the design meeting.

While there is no harm in trailing spaces the same is true for the function to remove it. And it seems the majority welcomes such a "beautifier" feature (intentionally naming it for a broader scope with the idea of proper indentation, for example).

Automatically changing the code sounds a bit dirty even when we have an option. So perhaps a command to run the function is the better choice.
Comment 11 Óvári 2022-12-16 09:50:38 UTC
(In reply to Heiko Tietze from comment #10)
> "beautifier" feature
Perhaps it is also part of what is known as "Lint Tools" or "Code Linting"?

> So perhaps a command to run the function is the better choice.
It would be better to remove the spaces at the end of a line when a line loses focus.