Strings with backslashes in Lister
Moderators: Hacker, petermad, Stefan2, white
Strings with backslashes in Lister
The subject is handling of escape sequences, enumerated in the help file: \\, \t, \n.
It feels that the current behaviour is more of a bug than a feature, because:
1. Counterintuitive: literal seach is expected, not escaped one.
When a string is selected and Ctrl+F pressed, the selection is copied and used as a search pattern - and even this same selection would never be found if it contained one of the magic sequences. This is baffling. Next, there is also inconvenience to scan the string, find offending sequences and add backslashes - particularly because backslashes are quite common in Windows, so this will happen sooner or later.
2. Inconsistent: c:\bin will find c:\bin, but c:\tin will fail on c:\tin. Consistent, as in regular expression, is to have double backslashes in search string - c:\\bin.
3. Creates a lot of confusion - my bug report has been appended to the help topic which already referred to a bunch of similar issues in different parts of the forum. And there are other topics related to the subject, not glued to the mentioned help topic.
Two alternatives might be considered.
Preferably, solution would be to make search literal by default, and add - similar to Akelpad - checkbox Esc sequences (\[0020], \\, \t, \n).
Or, a simpler way would be to add a checkbox forbidding escape sequences; and it might be ON by default.
It feels that the current behaviour is more of a bug than a feature, because:
1. Counterintuitive: literal seach is expected, not escaped one.
When a string is selected and Ctrl+F pressed, the selection is copied and used as a search pattern - and even this same selection would never be found if it contained one of the magic sequences. This is baffling. Next, there is also inconvenience to scan the string, find offending sequences and add backslashes - particularly because backslashes are quite common in Windows, so this will happen sooner or later.
2. Inconsistent: c:\bin will find c:\bin, but c:\tin will fail on c:\tin. Consistent, as in regular expression, is to have double backslashes in search string - c:\\bin.
3. Creates a lot of confusion - my bug report has been appended to the help topic which already referred to a bunch of similar issues in different parts of the forum. And there are other topics related to the subject, not glued to the mentioned help topic.
Two alternatives might be considered.
Preferably, solution would be to make search literal by default, and add - similar to Akelpad - checkbox Esc sequences (\[0020], \\, \t, \n).
Or, a simpler way would be to add a checkbox forbidding escape sequences; and it might be ON by default.
Re: Strings with backslashes in Lister
May feel buggy for you but it has been like this forever and should not be changed now just because you "feel" something 

Hoecker sie sind raus!
Re: Strings with backslashes in Lister
This indeed is a feature that has fooled a lot of users. Not only when using search in Lister, but also when searching for files containing a certain text. I agree that an explicit option should be created for this, like suggested by a number of people.
Re: Strings with backslashes in Lister
I support an option that enables literal search. But considering how long the search has worked this way, I guess it should be disabled by default. There could be an additional option in wincmd.ini that enables the literal search by default. I think that would satisfy long-time users who are used to the old way as well as (new) users who know it differently from other programs or have different expectations.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Strings with backslashes in Lister
How do you know what old users prefer? Old users never had the choice between literal search and extended search. Probably \n is used the most when the user actually wants to do an extended search. What do you think old users would prefer? Being able to type \n without having to click an option? Or being able to do a literal search without having to click an option or having to double backslashes?Dalai wrote: 2024-11-12, 21:32 UTC I support an option that enables literal search. But considering how long the search has worked this way, I guess it should be disabled by default.
... I think that would satisfy long-time users who are used to the old way...
Re: Strings with backslashes in Lister
The suggestion is about Lister's search, but there's much more to it than it might seem at first glance.
Lister's search can be more or less integrated into TC's search as the search terms are transferred to Lister's search when opening a file from TC's Find Files window. And if Lister's search is changed, the regular search has to change with it - otherwise it would become inconsistent or a complete mess.
Long-time users could have saved searches that would no longer work as expected when suddenly a literal search is performed instead. This can mislead users when search terms are not found when they were previously (or vice versa). I'll try to give an example. If someone has "\n" as part of a text search in a saved search, e.g. to find some text before and after a linebreak, a literal search wouldn't yield any results unless the file contains that text.
What I'm trying to say is that one has to be very careful when changing defaults, especially ones that change documented decade-old behavior. That's why I proposed a second setting that directly influences whether or not a literal search is performed by default.
Lister's search can be more or less integrated into TC's search as the search terms are transferred to Lister's search when opening a file from TC's Find Files window. And if Lister's search is changed, the regular search has to change with it - otherwise it would become inconsistent or a complete mess.
Long-time users could have saved searches that would no longer work as expected when suddenly a literal search is performed instead. This can mislead users when search terms are not found when they were previously (or vice versa). I'll try to give an example. If someone has "\n" as part of a text search in a saved search, e.g. to find some text before and after a linebreak, a literal search wouldn't yield any results unless the file contains that text.
What I'm trying to say is that one has to be very careful when changing defaults, especially ones that change documented decade-old behavior. That's why I proposed a second setting that directly influences whether or not a literal search is performed by default.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Strings with backslashes in Lister
I am fully aware of the relevance of saved searches, but in my opinion that is an implementation issue. A new default search method should not affect currently saved searches. If it does, it's simply implemented badly.Dalai wrote: 2024-11-13, 00:21 UTC Long-time users could have saved searches that would no longer work as expected when suddenly a literal search is performed instead. This can mislead users when search terms are not found when they were previously (or vice versa). I'll try to give an example. If someone has "\n" as part of a text search in a saved search, e.g. to find some text before and after a linebreak, a literal search wouldn't yield any results unless the file contains that text.
Re: Strings with backslashes in Lister
These wise words deserve to be moved to another topic (request moderators assistanceSir_SiLvA wrote: 2024-11-12, 19:21 UTC May feel buggy for you but it has been like this forever and should not be changed now just because you "feel" something![]()

Re: Strings with backslashes in Lister
From top of my head, there were no common program with non-literal search be default; grep is abnormal by definition.
Also, having two settings for essencially one options is a great way to mess things up.
It should be an explicit option in GUI, not a hidden toggle in .ini file.
For old-timer who already managed to figure out the peculiarities of the current implementation, it would be simple to tick a checkbox.
This means, a new user should first figure out how to enable literal searches with hidden option.Dalai wrote: 2024-11-12, 21:32 UTC I support an option that enables literal search. But considering how long the search has worked this way, I guess it should be disabled by default. There could be an additional option in wincmd.ini that enables the literal search by default.
Also, having two settings for essencially one options is a great way to mess things up.
It should be an explicit option in GUI, not a hidden toggle in .ini file.
For old-timer who already managed to figure out the peculiarities of the current implementation, it would be simple to tick a checkbox.
Re: Strings with backslashes in Lister
You misunderstood. With the first option I was referring to a checkbox in both Lister's search and Find Files. With the second option I meant an INI setting that controls whether or not this checkbox is enabled by default, and possibly save the checkbox state at the same time.browny wrote: 2024-11-13, 10:21 UTCThis means, a new user should first figure out how to enable literal searches with hidden option.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Strings with backslashes in Lister
General search disables escape characters, regular expression enables escape characters.
This is what most people are used to.
This is what most people are used to.
Re: Strings with backslashes in Lister
Maybe. Option upon option and more in .ini file to control a part of the option... the word mess was already mentioned.
Versus simple and clear: literal search by default, escaped if user ticks it.
Regular expression have too many characters to be screened and are tough to read, so simplified escape sequences are handy in certain cases.xxxdo1 wrote: 2024-11-13, 11:23 UTC General search disables escape characters, regular expression enables escape characters.
Re: Strings with backslashes in Lister
Adding too many checkbox options is not a good idea.
Regular expressions contain escape characters, and the two do not conflict.
In my usage, I use regular expressions when I need to escape characters, and for general searches I consider it disabled.
Regular expressions contain escape characters, and the two do not conflict.
In my usage, I use regular expressions when I need to escape characters, and for general searches I consider it disabled.
Re: Strings with backslashes in Lister
2xxxdo1
An how do you find line breaks with regexp - $ only finds the line end in the first line. .$ find most line breaks but not in empty lines.
An how do you find line breaks with regexp - $ only finds the line end in the first line. .$ find most line breaks but not in empty lines.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Strings with backslashes in Lister
2petermad
I was wrong, I used boost regular expression, it supports escape characters, it can use \n to find line breaks.
I was wrong, I used boost regular expression, it supports escape characters, it can use \n to find line breaks.