Dykam / tabbychat

TabbyChat chat mod for Minecraft
16 stars 0 forks source link

Inverse Matching Bug #58

Open iHwin opened 10 years ago

iHwin commented 10 years ago
  1. 'Send matches to tab' checked.
  2. 'Inverse match' checked.

Using these settings to filter out certain messages. Inverse matching works correctly when the message is short and only takes up a single line. Inverse matching fails when the message is long enough that it wraps to the next line(s).

2014-07-20_18 21 42 2014-07-20_18 21 44 2014-07-20_18 21 51

Expected Result: All of those [G] and [Tr] messages should be filtered out. Actual Result: Single line messages are filtered out, multiple line messages are not.

Note: Filtering messages with 'Inverse match' unchecked has no issues when they are single or multiple lines. 2014-07-20_18 24 16

mattmess1221 commented 10 years ago

This has been here since 1.6. This happens because it parses the message by line. In 1.7, the entire message is sent on one line instead of the server splitting it for us. The main reason is me being too lazy to change it to split right before it's rendered.

mattmess1221 commented 10 years ago

I think I might remove the inverse option. It's something you can do easily in regex anyway by pre-pending '!'.

I tested this with the expression "^\<", and inverted, matching not speech, and sent it to a tab. I was unable to reproduce no matter the length of my message. When I colored it though, only the first line was effected. I'm going to fix that, and hopefully, this issue will get fixed with it.

iHwin commented 10 years ago

As far as I know you actually can't just pre-pend the regex with an '!' to invert it. This must be done with the negative lookahead assertion '?!' like so: (?!foo). Simply adding an '!' in front will return no results, which may be the reason why you were unable to reproduce it. A brief example:

foo bar cat

Searching for "(?!foo)" returns "bar" & "cat". Searching for "!foo" or "!(foo)" returns nothing (it literally searches for "!foo", which is not there).

I tested your same expression "^\<", inverted it like so "^(?!\<)", and sent it to a tab. I was able to successfully reproduce the multiple lines issue. I am not sure how you inverted it in your test, but please try entering the "/help" command in game to make sure that the filter is working properly. It should filter out player chat and still display the help page.

mattmess1221 commented 9 years ago

Your filter is wrong. It should be this. ^\[(G|V|Tr|Auc)\]