About Those Pesky Leading And Trailing Spaces

The latest development releases have added some really nice and useful features, and improved on others. Thank you, @Florian. All are superb tweaks that continue to enhance the UX.

My request concerns those pesky leading and trailing spaces. Since these are invisible, is it feasible to provide support for an option to get them highlighted in all fields? Is there perhaps another way to achieve this?

Rather than viewing them, I recommend eliminating them using the existing command: $trim

It's also fine to use it if there are no "pesky leading and trailing spaces".

From the documentation about scripting functions:

$trim(x,c) trims all leading and trailing whitespace from the string x. The optional second parameter c specifies the character to trim.

Update:

Another approach - for a single field - is to click on it in the File List:


This allows you to see any leading or trailing spaces.
Sorting the columns will result in entries containing a leading space being listed at the top.

You could filter for dedicated fields (here: ARTIST) with trailing or leading spaces:
"$if($eql($len(%artist%),$len($trim(%artist%))),1,0)" IS "0"

Also, have a look at the FAQs:

Good idea! Thanks to another Filter
"$if($eql($len(%TITLE%),$len($trim(%TITLE%))),1,0)" IS "0"
I just found this case:

image
(I still need to investigate why my $trim action didn't find it. Most probably I just forgot to apply it...)

I'm using a filter like this

album MATCHES ^\s OR album MATCHES \s$

Good day, gentlemen.

Thank you for the helpful advice on finding and fixing unwanted spaces. I recently discovered, much to my embarrassment, that I had accidentally introduced many of these myself. If they had been visible at the time, it would have saved me considerable effort.

This highlights a broader need: many people rely on visual cues while working. Just as features like the album-cover previewer are useful assistants, a visual highlight for leading and trailing spaces would be invaluable. It would allow users to quickly see all such spaces across all fields and files, apply fixes (including experimental ones), and immediately see the results.

IMHO a visual check is far from reliable.
How lnes would you display at any one time? 50? With 10,000 files you would need to scan through 1000 screen pages.
If you are quick and need 5 seconds, then it would take more than 15 minutes of focussed scrolling. I bet that some candidates will slip through.
Also, I am pretty sure that some fields will contain more data than the column is wide. So scrolling individual fields would be required. This would also slow down the process with all its pit falls of still overlooking some.

And all this could be cut short by a simple filter with 100% accuracy. Even typing in the filter is much quicker than the visual inspection with all its sources for error.

Anyway, until the feature is implemented, the filter would be the fastest way to find the extra spaces.

I fully agree that a filter is the fastest method for the initial finding stage, which is essential.

My request complements that: a subsequent review mode where the user can visibly verify the flagged instances and preview the impact of the remediation.

The one big limitation is that invisible characters (like leading or trailing spaces or tab characters) can't be reviewed visually unless the system replaces them with placeholders. A review mode would therefore need some kind of symbol‑based visualization to make those hidden characters visible.

You can see the problem with this Forum. How would you display a Space? Or a Tab?
With something like ␣ for Space and ⇄ for Tab?
If you do that, you'll be asked: "What is this character?" How can I replace that?

Have you tried the Edit>Find... function with the regular expression \s$ for trailing spaces.
There you get a list of files with files and the fields in which the hit occurred.
And if you want to apply e.g. $trim() to one of the found fields, then you can use Convert>Tag-Tag and the preview function which shows you "before" and "after".
So in a way it is all already there, just missing the colouring.

In general: i would investigate which steps in your workflow introduced the extra spaces and then try to eliminate the root cause.

I never care about finding leading or trailing spaces. I just use $trim() in my workflow.

Exactly.
It is a good idea to check the collection once in a while whether those spaces have crept in and then simply remove them. Further inspection is superfluous IMHO:

Thank you, everyone. I have to go and experiment to see how your esteemed proposals play out for me.