"-" as master invert operator?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

"-" as master invert operator?

Post by admin »

Currently the first ! is interpreted as a master invert for the entire pattern; that leaves a blatant hole:

Code: Select all

Size: 529 KB | Ext: txt   => (Size = 529 KB) OR (Extension = "txt")
Size: 529 KB | !Ext: txt  => (Size = 529 KB) OR NOT (Extension = "txt")
!Size: 529 KB | Ext: txt  => NOT ((Size = 529 KB) OR (Extension = "txt"))
--- missing ---           => NOT (Size = 529 KB) OR (Extension = "txt")
Idea: Should we introduce - as master invert operator?

Code: Select all

Size: 529 KB | Ext: txt   => (Size = 529 KB) OR (Extension = "txt")
Size: 529 KB | !Ext: txt  => (Size = 529 KB) OR NOT (Extension = "txt")
!Size: 529 KB | Ext: txt  => NOT (Size = 529 KB) OR (Extension = "txt")
-Size: 529 KB | Ext: txt  => NOT ((Size = 529 KB) OR (Extension = "txt"))

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: "-" as master invert operator?

Post by admin »

PS: For find patterns there is a tweak FindAllowMasterInvert which is 0 by default. Whereas for filter patterns it's currently hard-coded to YES (AllowMasterInvert). So there is an inconsistency as well.

Horst
Posts: 1085
Joined: 24 Jan 2021 12:27
Location: Germany

Re: "-" as master invert operator?

Post by Horst »

Sound like a good idea
but the current meaning of ! will change and may be a surprise for some users.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
Portable XYplorer (actual version, including betas)
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: "-" as master invert operator?

Post by admin »

I could handle this by a tweak (auto-set on upgrade) that preserves the old functionality.

Online
eil
Posts: 1617
Joined: 13 Jan 2011 19:44

Re: "-" as master invert operator?

Post by eil »

while i understand the idea behind the change, why not simply add "!!" as master invert, or make a rule that "!term" = "invert this one", "! term"(must have space) = "master invert".
this way no need for a tweak and any user understands "!" as invert, unlike "-".
Win 7 SP1 x64 100% 1366x768

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: "-" as master invert operator?

Post by admin »

I had thought about that, but

a) "!!" is NOT NOT and eats itself (that's what users would rightfully expect).

b) Currently you can use ! term to look for NOT " term", so the space is part of the string.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: "-" as master invert operator?

Post by admin »

But here is another idea. Currently Filters don't support complex syntax with parentheses (like Find Files does), but I could make filters understand one simple case:
!(Size: 529 KB | Ext: txt)

Okay, this would destroy the possibility to do something like NOT "(a*)" since !(a*) would be parsed as !a*. But you could escape the parentheses (one of them is enough): !\(a*). So, I don't see many problems here.

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: "-" as master invert operator?

Post by highend »

Currently Filters don't support complex syntax with parentheses (like Find Files does)
and if you change that?

I'd find !(...) the best and most logical way to do a global negation and parentheses would be a good way to group things anyway...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: "-" as master invert operator?

Post by admin »

As you may have noted, the various areas are becoming more and more similar and consistent (and internally more and more use the same code, of course). So one day the complex Boolean syntax with parentheses will be supported all over the place.

(Due to the high degree of optimization, especially in Find Files, this cannot be done quickly.)

Evolve
Posts: 353
Joined: 27 Feb 2020 09:48

Re: "-" as master invert operator?

Post by Evolve »

How about human-readable python-like operators?
Size: 529 KB or Ext: txt
Size: 529 KB or not Ext: txt
not Size: 529 KB or Ext: txt
not (Size: 529 KB or Ext: txt)

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: "-" as master invert operator?

Post by admin »

Apart from "not " in filters it's all there already.

PS: Next beta "not " is supported everywhere.

Post Reply