Filenames - invalid characters on pasting new name...

Have a suggestion for "Everything"? Please post it here.
Post Reply
meteorquake
Posts: 367
Joined: Thu Dec 15, 2016 9:44 pm

Filenames - invalid characters on pasting new name...

Post by meteorquake »

Often I paste something into the filename to make its name that's copied from text in a document and may contain colons etc, unsuitable for filenames.
At the moment you get a warning and have to manually edit the offending characters.
Usually I'd just want it to be saveable as a name and not fussed about specifics of what such characters turn into - it would be ideal if it had the ability to replace such characters with something like a dash, the warning's good to keep.
Perhaps there's an option already to do this? I didn't spot one... maybe one could specify an autofix symbol (that replaces bad filename characters on a rename), and if blank require the user to fix the name manually...
Cheers!
David
NotNull
Posts: 5167
Joined: Wed May 24, 2017 9:22 pm

Re: Filenames - invalid characters on pasting new name...

Post by NotNull »

That is just like Windows behaviour. You will see the same in File Explorer.

What happens when you press ENTER instead of ESC?
Here it pastes the text without the illegal characters.
meteorquake
Posts: 367
Joined: Thu Dec 15, 2016 9:44 pm

Re: Filenames - invalid characters on pasting new name...

Post by meteorquake »

I'm sure it isn't windows behaviour though - if I do it in File Explorer it fixes any problem symbols without prompt (but with an unobstructing notification) whether typed or pasted, by not typing the keystroke in the case of typing and skipping the problem symbols in any paste... d
meteorquake
Posts: 367
Joined: Thu Dec 15, 2016 9:44 pm

Re: Filenames - invalid characters on pasting new name...

Post by meteorquake »

OH actually it's not the problem I thought - the symbols are typed, you get a warning, but they disappear on entring, so then resembling Explorer, except for the symbols appearing during edit.
However the resolution I mention is still an important one, as I think it's better for an intelligent replacement of symbols by another, so ab:cd doesn't become abcd but becomes eg ab-cd (according to one's setting).
Cheers, David
void
Developer
Posts: 15096
Joined: Fri Oct 16, 2009 11:31 pm

Re: Filenames - invalid characters on pasting new name...

Post by void »

Everything will remove invalid characters when you press ENTER.

I will consider an option to replace the invalid characters with other text or formatting.



I have put on my TODO list to add a customizable preprocessor search function to the rename edit control.
With this, you'll be able to rewrite invalid characters from your pasted text.

Thank you for the suggestion.
meteorquake
Posts: 367
Joined: Thu Dec 15, 2016 9:44 pm

Re: Filenames - invalid characters on pasting new name...

Post by meteorquake »

Thanks so much Void.
And an addition to the suggestions - the option to have renames trim whitespace from the start and end of the filename base (i.e. the bit minus the extension) and to single-space any multiple whitespaces. All whitespaces incl. non-breaking spaces converted to Asc 32 if not already. These are common matters when copying text from somewhere and pasting as the filename.
Cheers! David
void
Developer
Posts: 15096
Joined: Fri Oct 16, 2009 11:31 pm

Re: Filenames - invalid characters on pasting new name...

Post by void »

Everything 1.5.0.1334a makes the following changes:

All unicode spaces (instead of just ASCII space) are now trimmed from the stem (and extension for files).
You can turn this off with rename_trim



Trailing dots (.) are also removed for files.
You can turn this off with rename_trim



Added a rename_paste_format ini setting to customize the paste format.

Use $newtext: to reference the pasted text.
Use the preprocessor to format the pasted text.
Leave empty to paste the new text as is. (default)

For example, convert the pasted text to title case:
  • Copy and paste the following into your Everything search box:
    /rename_paste_format=[titlecase:$newtext:]
  • Press ENTER in your Everything search box.
For example, replace : with -
  • Copy and paste the following into your Everything search box:
    /rename_paste_format=[regexreplace:$newtext:,":","-"]
  • Press ENTER in your Everything search box.
For example, replace :, or / or \ with -
  • Copy and paste the following into your Everything search box:
    /rename_paste_format=[regexreplace:$newtext:,"[:/\\]","-"]
  • Press ENTER in your Everything search box.


Control characters ( < ' ' ) are always removed.
You can use rename_paste_format to convert control characters before they are removed.



The "a filename can't contain any of the following characters'" balloon will now update it's position correctly.
Post Reply