GHC 2017-06-04

10 comments.

, https://git.io/vHaOQ in jarun/nnn
It works.

, https://git.io/vHaO7 in jarun/nnn
(Updated the example in the last comment. Sorry for the confusion.)

, https://git.io/vHaqy in jarun/nnn
> So you mean you are deleting the chars one by one using the DEL key?

Yeah. `^?` is shown when `DEL` deletes the last character. Basically:

- Press `/`: `/`;
- Press `a`: `/a`;
- Press `DEL`: `/a^?`;
- Press `s`: `/s`.

, https://git.io/vHaqS in Homebrew/homebrew-core
youtube-dl 2017.06.05
=====================

Created with `brew bump-formula-pr`.

, https://git.io/vHaq9 in jarun/nnn
Well `filter` is a pointer to a C string, so testing whether its NULL doesn't help... If I put `strcmp(filter, "") != 0` there, of course the message is suppressed, but now for some reason part of `DEL` handling code is not firing, resulting in `^?` shown in the buffer (which is removed if I type another non-`DEL` character).

, https://git.io/vHaLc in jarun/nnn
The issue is actually very simple: BSD/macOS regex library does not support empty patterns. Try this:

```c
#include <stdio.h>
#include <regex.h>

int main() {
    regex_t regex;
    int errcode;
    char msgbuf[80];
    errcode = regcomp(&regex, "", REG_NOSUB | REG_EXTENDED | REG_ICASE);
    if (errcode != 0) {
        regerror(errcode, &regex, msgbuf, sizeof msgbuf);
        printf("%s\n", msgbuf);
    }
}
```

On GNU/Linux nothing is printed. On macOS you get `empty (sub)expression`.

To fix this you need to check whether the filter expression is empty, an unfilter when it is. I'll need to read nnn's code to cook up a patch.

, https://git.io/vHaLC in jarun/nnn
I did a quick bisect and it's been there since the very beginning: 1fdcaef4f58ec277ff45c3aed3bef469a6797bcc. I probably don't have time to dig deeper today.

, https://git.io/vHaLW in jarun/nnn
> please explain what you mean by this in simplified terms. I am lost. Had been working for long...

Sorry, just realized it's not in the code, and only seems to happen on macOS. Basically, you type anything into the filter prompt, then delete everything (resulting in an empty string), an `empty (sub)expression` message is shown.

, https://git.io/vHaJe in jarun/nnn
Expanding on the "confusing" part: I managed to land in my editor a couple of times when I thought I was typing in the filter prompt. Not sure I can reproduce that now.

, https://git.io/vHaJv in jarun/nnn
I played with it for a few minutes and this mode seems rather confusing to me, but I guess the worst part isn't even related to this mode. I don't see the point of `empty (sub)expression`. It's *so* in-your-face and even hides the filter prompt. What's the point? When my filter expression is empty, I'd expect an unfiltered listing.