GHC 2017-05-03

21 comments.

, https://git.io/v9Eq8 in jarun/nnn
Isn't Nautilus the default? Anyway, I don't use Ubuntu Desktop.

, https://git.io/v9Eq4 in jarun/nnn
And I would assume custom icons of Nautilus do not work in other file managers.

, https://git.io/v9EqB in jarun/nnn
Okay, apparently it actually is a thing.

, https://git.io/v9EqR in jarun/nnn
> Would it work if the dir is mounted remotely on another OS?

If the other OS implements the feature. Most likely not. Is custom icons for directories even a thing on Linux? I'd assume not since there are a gazillion file managers/browsers.

, https://git.io/v90Dk in jarun/nnn
> Bad design on someone's part I'ld say.

It's very rare so hardly an issue. The format of that file is poorly documented so most developers don't know how to make one even if they want to (I happen to be one of the small subset of power users / developers who actually looked into this format). Hidden by default too so most people never notice them. Besides, I'm doubtful that a central registry is better suited for this purpose. How would you allow a custom icon for any directory, that is persisted across duplication, network shares, etc.? Directories can't have resource forks AFAIK so you have to use a file inside.

If you want to see an example of an actual fucked up design in macOS's file browser, google `.DS_Store`.

, https://git.io/v90DI in jarun/nnn
> Or, was it a custom icon name? ;)

If you want to set a custom icon for a directory, yes, you need a stupid `$'Icon\r'`.

, https://git.io/v90DL in jarun/nnn
As I said, I always preferred --quoting-style=escape.

Wait, tbh, I don't give a shit. I don't use stupid characters in filenames :)

, https://git.io/v90Dt in jarun/nnn
Okay.

, https://git.io/v90Dq in jarun/nnn
Well, since you set out to replicate `ls --quoting-style=literal`, you can just do

```
if ((*buf >= '\x01' && *buf <= '\x1f') || *buf == '\x7f')
```

and call it a day. FWIW I've never seen ESC in a filename either, except by mistake.

, https://git.io/v90DY in jarun/nnn
> we didn't have to check each character because all but ESC fall in a range.
>
>     if ((*buf >= '\a' && *buf <= '\r') || *buf == '\e')

Actually, that's not true. The full set of control characters is `00`–`1F` plus `7F`.

, https://git.io/v9RSS in jarun/nnn
Bash has no builtin file listing facilities. If you mean ls, it's not that simple. The default behavior of coreutils ls(1) changed in 8.25, where the default quoting style became `shell` when stdout is a tty, so by default `$'Icon\r'` is printed as `'Icon'$'\r'`. You apparently don't want that. Judging from your transcripts, you're either using 8.24 or earlier, or your ls is aliased with `--quoting-style=literal`. But there are other equally valid and more informative quoting styles, e.g., `escape`, where `'$'Icon\r'` would be `Icon\r`, `$'1\a2'` would be `1\a2`, etc (basically, ANSI-C quoting without the quotes).

, https://git.io/v9RS9 in jarun/nnn
Still, `BEL` is currently printed as `^G`, `ESC` is currently printed as `^[`, etc., so it's not consistent.

, https://git.io/v9RSH in jarun/nnn
Uh, okay, I made a mistake in my previous test and thought non-printable characters are currently escaped as hex. Apparently not.

, https://git.io/v9RMh in jarun/nnn
I didn't read the code but what's the problem with replacing them with two characters? Allocating another buffer? I mean, however non-printable characters are currently escaped, you can do this the same way, no?

, https://git.io/v9RMj in Homebrew/homebrew-core
Okay...

, https://git.io/v9RDe in Homebrew/homebrew-core
CI failure is not my fault:

```
        ==> Installing or updating 'rubocop' gem
Building native extensions.  This could take a while...
Error: The 'rubocop' gem is installed but couldn't find 'rubocop' in the PATH:
```

, https://git.io/v9RDv in jarun/nnn
`\r`/`\n` is more reasonable because `\x1b` is not printed as `?`, but rather, `\x1b`.

, https://git.io/v9RDf in jarun/nnn
I would either use `?` or `\r`/`\n`.

, https://git.io/v9RDJ in jarun/nnn
> Or, am I using wrong characters/quotes?

By `$'Icon\r'` I mean `Icon<CR>`, i.e.,

```
echo -n $'Icon\r' | xxd
00000000: 4963 6f6e 0d                             Icon.
```

, https://git.io/v9R65 in jarun/nnn
By the way, `$'\n'` is also not escaped.

, https://git.io/v9R6d in jarun/nnn
<img width="235" alt="screen shot 2017-05-02 at 11 08 20 pm" src="https://cloud.githubusercontent.com/assets/4149852/25647007/43644ec4-2f8c-11e7-9561-190ea582737c.png">

That blank line should be a `$'Icon\r'`. The CR is probably printed unquoted, so the line is overwritten.