RFE: Paste stem:<list>

Discussion related to "Everything" 1.5 Alpha.
Post Reply
therube
Posts: 4985
Joined: Thu Sep 03, 2009 6:48 pm

RFE: Paste stem:<list>

Post by therube »

RFE: Paste stem:<list>

Or is there a method to do so already?

so (a Paste of):
red.jpg
blue.txt

gives:
red|blue


How would you do that with a keyboard?
Ctrl+Shift+INS? That would be mighty awkward?
Alt+INS would work.
void
Developer
Posts: 16777
Joined: Fri Oct 16, 2009 11:31 pm

Re: RFE: Paste stem:<list>

Post by void »

Currently, I don't have an option to do this.



The next alpha update will have a bookmark option to do this.
For example:

/replace-sel stem:<<trim:<regexreplace:clipboard:,"(?m)^(.*)\.[^\.]*$","$1|">,"|">>

(replaces each line with the stem + | and trims the final |)



I will also consider a stemfilelist1: search option.
I will also consider a stem:remove-extension:<red.jpg|blue.txt> search option.
void
Developer
Posts: 16777
Joined: Fri Oct 16, 2009 11:31 pm

Re: RFE: Paste stem:<list>

Post by void »

Everything 1.5.0.1360a fixes an issue with regexreplace not working with multiple lines.

To create a bookmark to paste the stems of filenames from the clipboard:
  • In Everything 1.5, from the Bookmarks menu, click Add to bookmarks.
  • Change the Name to: Paste Stem
  • Change the Search to:

    Code: Select all

    /replace-sel stem:<<trim:<regexreplace:clipboard:,"(?m)^(?:.*\\)?(?:([^\\\r\n]*)\.[^\\\r\n\.]*|([^\\\r\n\.]*))\r?$","$1$2|">,"|">>
    
  • Optionally set a keyboard shortcut.
  • Click OK.


edit: old code:

Code: Select all

/replace-sel stem: <<trim:<regexreplace:clipboard:,"(?m)^(.*)\.[^\.]*$","$1|">,"|">>
(incorrectly matches newlines with [^\.])



I'm still working on adding stemfilelist1:
tuska
Posts: 1052
Joined: Thu Jul 13, 2017 9:14 am

Re: RFE: Paste stem:<list>

Post by tuska »

Thank you!
I have inserted a space after stem: ...

Code: Select all

/replace-sel stem: <<trim:<regexreplace:clipboard:,"(?m)^(.*)\.[^\.]*$","$1|">,"|">>
tuska
Posts: 1052
Joined: Thu Jul 13, 2017 9:14 am

Re: RFE: Paste stem:<list>

Post by tuska »

I have encountered a problem with a total path length greater than 259 characters.

Copy path and file name to clipboard

Code: Select all

D:\259 Zeichen\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\aaa.docx
D:\259 Zeichen\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\bbb.docx
D:\259 Zeichen\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\üöäÜÖÄߧ&.txt
Presentation in short form
aaa.docx
bbb.docx
üöäÜÖÄߧ&.txt

Execute bookmark

Code: Select all

stem: <D:\259 Zeichen\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\aaa|D:\259 Zeichen\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\bbb|D:\259 Zeichen\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\üöäÜÖÄߧ&>
Presentation in short form
stem: <aaa|bbb|üöäÜÖÄߧ&>

Result (without warning that not all files were taken into account)

Code: Select all

D:\259 Zeichen\Daten\Programme\TotalCommander\TCD_USB-Stick\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\TC32-64USB\Migration\_Forumsanfragen\Ansichtsmodus_ViewMode\Ansichtsmodus-Rückstellung-auf-Vorgabe_50-50pct\üöäÜÖÄߧ&.txt
Presentation in short form
üöäÜÖÄߧ&.txt
aaa.docx and bbb.docx missing.

Please check.
Thank you.
_________________________________________________________________________________
Everything 1.5.0.1360a (x64) | Windows 11 Pro (x64) Version 23H2 (OS build Build 22631.2715)

Registry:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

DWORD-Value (32-Bit) ...
LongPathsEnabled | Value: 1 | Basis: Hexadecimal
void
Developer
Posts: 16777
Joined: Fri Oct 16, 2009 11:31 pm

Re: RFE: Paste stem:<list>

Post by void »

Thank you testing tuska,

Why add a space after stem:?

The intention here was to search for stems matching the stems from the full name from the clipboard.



I'm seeing the expected results my end: aaa.docx and bbb.docx are found.
Do you have any search options enabled under the Search menu?



The regex could be improved because [^\.] matches newlines...

Please try the following bookmark search:

Code: Select all

/replace-sel stem:<<trim:<regexreplace:clipboard:,"(?m)^(?:.*\\)?(?:([^\\\r\n]*)\.[^\\\r\n\.]*|([^\\\r\n\.]*))\r?$","$1$2|">,"|">>
edit: old code:

Code: Select all

/replace-sel stem:<<trim:<regexreplace:clipboard:,"(?m)^(?:.*\\)?([^\\\n]*)\.[^\\\.\n]*$","$1|">,"|">>
(doesn't work for filenames without an extension)
tuska
Posts: 1052
Joined: Thu Jul 13, 2017 9:14 am

Re: RFE: Paste stem:<list>

Post by tuska »

void wrote: Fri Nov 17, 2023 3:34 am Why add a space after stem:?
I get no result without a space after stem:.
Bookmark: "Search: Custom"

Code: Select all

/replace-sel stem:<<trim:<regexreplace:clipboard:,"(?m)^(.*)\.[^\.]*$","$1|">,"|">>
Example: stem:<C:\totalcmd\wincmd|C:\totalcmd\wincmd_Buttonbar>

The following is interesting for me: CRLF
If I copy the result (with space after stem:) from the Everything search box into the Text editor...
(EmEditor Pro v23.0.1 (64-bit) - No Wrap (Ctrl+1))

Code: Select all

stem: <C:\totalcmd\wincmd|  *)
C:\totalcmd\wincmd_Buttonbar>
*) then the following character is inserted here after '|':
U+000D U+000A
UTF-16LE: 0x000D 0x000A
CARRIAGE RETURN (CR); LINE FEED (LF)
Unicode Script: Zyyy (Common): Zyyy (Common)
Unicode General Category: Cc (Control): Cc (Control)

Normally, after a copy action, each content of the Everything search line is transferred 1:1 to the text editor, i.e. in one line.
void wrote: Fri Nov 17, 2023 3:34 am I'm seeing the expected results my end: aaa.docx and bbb.docx are found.
Do you have any search options enabled under the Search menu?
No, only Everything is selected.
void wrote: Fri Nov 17, 2023 3:34 am Please try the following bookmark search:
/replace-sel stem: <<trim:<regexreplace:clipboard:,"(?m)^(.*)\.[^\.\n]*$","$1|">,"|">>
Here I get this result in the search box of Everything:

Code: Select all

stem: <clipboard[b][/b]:>
void wrote: Fri Nov 17, 2023 3:34 am If you want to strip the path part too, please try:
/replace-sel stem:<<trim:<regexreplace:clipboard:,"(?m)^(?:.*\\)?([^\\\n]*)\.[^\\\.\n]*$","$1|">,"|">>
Result as before:

Code: Select all

stem:<clipboard[b][/b]:>
 
2023-11-17_Paste stem - list.png
2023-11-17_Paste stem - list.png (61.74 KiB) Viewed 5274 times
tuska
Posts: 1052
Joined: Thu Jul 13, 2017 9:14 am

Re: RFE: Paste stem:<list>

Post by tuska »

2void
I tested your suggestions again.
(I think there must have been an additional problem with the clipboard in a previous test).
void wrote: Fri Nov 17, 2023 3:34 am Please try the following bookmark search:

Code: Select all

/replace-sel stem: <<trim:<regexreplace:clipboard:,"(?m)^(.*)\.[^\.\n]*$","$1|">,"|">>
This code works (in the active path) because it has a space after stem:
With this code, only the file "üöäÜÖÄߧ&.txt" is displayed, but not the files "aaa.docx", "bbb.docx" -> Total path >259 characters.
Workaround: After executing the bookmark (CODE below!...), set the path BEFORE the code: Path\ stem:<aaa|bbb|üöäÜÖÖߧ&>
void wrote: Fri Nov 17, 2023 3:34 am If you want to strip the path part too, please try:

Code: Select all

/replace-sel stem:<<trim:<regexreplace:clipboard:,"(?m)^(?:.*\\)?([^\\\n]*)\.[^\\\.\n]*$","$1|">,"|">>
This code works (in all paths) for me with and without a space after stem:
With this code, the files "aaa.docx", "bbb.docx" and "üöäÜÖÄߧ&.txt" are also displayed -> Total path >259 characters.

This code - bookmark: "Paste Stem" only works (in the active path) for me with a space after stem: - as already mentioned above:
(The following code for the bookmark differs slightly from the code (also for a bookmark) at the beginning of this post).

Code: Select all

/replace-sel stem: <<trim:<regexreplace:clipboard:,"(?m)^(.*)\.[^\.]*$","$1|">,"|">>
Thank you for your efforts!
void
Developer
Posts: 16777
Joined: Fri Oct 16, 2009 11:31 pm

Re: RFE: Paste stem:<list>

Post by void »

Thank you for testing the regexreplace tuska,

I found the following to work rather well:

Code: Select all

/replace-sel stem:<<trim:<regexreplace:clipboard:,"(?m)^(?:.*\\)?(?:([^\\\r\n]*)\.[^\\\r\n\.]*|([^\\\r\n\.]*))\r?$","$1$2|">,"|">>
This one will strip the starting path part, remove the extension if it exists and do nothing if the text is already a stem.
It was a pain to match this, capture it and skip the trailing \r

(?m) = multiline mode
^ = start of line
(?:.*\\)? = don't capture and skip till the last \ (if it exists)
(?: ... ) = don't capture and specify the OR group
([^\\\r\n]*) = capture stem part to $1
\.[^\\\r\n\.]* = match extension
| = OR
([^\\\r\n\.]*) = capture text that is already a stem to $2
\r?$ = match \r (if it exists) and match the end of the line

stemfilename1: will make this soo much easier..
tuska
Posts: 1052
Joined: Thu Jul 13, 2017 9:14 am

Re: RFE: Paste stem:<list>

Post by tuska »

2void
Thank you for your effort and the new code!

With this I get much more results (on the topic: "in all paths").

Code: Select all

New code: 1 152 items (655 files, 497 folders)
Old code:   436 items (424 files,  12 folders)
void
Developer
Posts: 16777
Joined: Fri Oct 16, 2009 11:31 pm

Re: RFE: Paste stem:<list>

Post by void »

Everything 1.5.0.1361a adds more values to the paste_multiline_type advanced setting.

You can now pick between name and stem.



To paste the name part of multiple lines of filename text:
  • In Everything 1.5, from the Tools menu, click Options.
  • Click the Advanced tab on the left.
  • To the right of Show settings containing, search for:
    paste
  • Select paste_multiline_type.
  • Set the value to: Name
  • Click OK.


To paste the stem part of multiple lines of filename text:
  • In Everything 1.5, from the Tools menu, click Options.
  • Click the Advanced tab on the left.
  • To the right of Show settings containing, search for:
    paste
  • Select paste_multiline_type.
  • Set the value to: Stem
  • Click OK.


Everything 1.5.0.1361a also adds a /search_edit_paste search command.

To create a bookmark (with an optional keyboard shortcut) to paste the name part of multiple lines of text:
  • In Everything 1.5, from the Bookmarks menu, click Add to bookmarks.....
  • Change the Name to: Paste Names
  • Change the Search to: /search_edit_paste 0 1 2
  • Optionally set a keyboard shortcut.
  • Click OK.


To create a bookmark (with an optional keyboard shortcut) to paste the stem part of multiple lines of text:
  • In Everything 1.5, from the Bookmarks menu, click Add to bookmarks.....
  • Change the Name to: Paste Stems
  • Change the Search to: /search_edit_paste 0 1 3
  • Optionally set a keyboard shortcut.
  • Click OK.


Everything 1.5.0.1361a also adds name-filelist1: and stem-filelist1: search function.

To match the name part only, include the following in your search:

name-filelist1:

Hold down Ctrl and click the name-filelist1: text in your search box.
Paste your multiple lines of filename text into the file list slot.
Click OK.



To match the stem part only, include the following in your search:

stem-filelist1:

Hold down Ctrl and click the stem-filelist1: text in your search box.
Paste your multiple lines of filename text into the file list slot.
Click OK.

File List Slots
therube
Posts: 4985
Joined: Thu Sep 03, 2009 6:48 pm

Re: RFE: Paste stem:<list>

Post by therube »

paste_multiline_type -> Stem

This has been working out nicely, thanks :-).
Post Reply