[8.51a] Search for tab character alone breaks search history

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Valentino
Power Member
Power Member
Posts: 706
Joined: 2003-02-07, 00:21 UTC
Location: Ukraine

[8.51a] Search for tab character alone breaks search history

Post by *Valentino »

Hi

1. Search for tab character (copy/paste real tab character, not \t) in Find Files or Lister. Succeeds.
2. Open Find Files or Find in Lister again - text search history is empty.

Config file seems OK:
0=
1=text1
2=text2
...

Seems like value from config file is trimmed upon reading and history read process is stopped when value is empty.

Thanks!
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

It's probably related to that issue.

TC stops reading remaining keys if one appears to be empty.
The main cause here seems: Ini files skip leading and trailing whitespace,
i.e. a thing like

Code: Select all

key=__value__
will read as "value", and a single tab char stored in the ini will therefore appear as an empty value.
(see for example here)


Probably also related:
Christian seems to correctly use quotes around whitespace for things like

Code: Select all

_abc_
-> stored as

Code: Select all

"_abc_"
in ini,
but doesn't store a key at all when I use a single space char as search.
TC plugins: PCREsearch and RegXtract
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48118
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Yes, the Windows ini reading functions return empty data for just a tab. I can try to put it in double quotes.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Or you can add BOM to strings that look like empty ones: BOM sequence itself (mentioned in another thread), tab, space... so it won't be empty for INI API and you'll cut BOM then.
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

MVV wrote:BOM sequence itself (mentioned in another thread), tab, space... so it won't be empty for INI API.
You'd still need to put quotes around it, because otherwise trailing whitespace will still be removed by GetPrivateProfileString.

Fixing it would be nice, but I think the main problem here is: TC shouldn't skip remaining keys if it finds en empty one,
no matter why that key appears empty.
TC plugins: PCREsearch and RegXtract
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

It is not your problem if you use WritePrivateProfileString to store strings and then GetPrivateProfileString to read them: first one quotes string when necessary (as I remember, if string starts or ends with whitespace and if string starts and ends with quotes) to ensure that second one will read exact string that was passed to first one.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Tab character doesn't break history in 8.52b1 but BOM still does that. Please fix it too, searching for BOMs is quite useful sometimes.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48118
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for confirming the fix. The BOM problem was postponed to TC 9.
Author of Total Commander
https://www.ghisler.com
Post Reply