Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with \t and \n in file names #156

Closed
nrdmn opened this issue Apr 12, 2017 · 3 comments
Closed

issues with \t and \n in file names #156

nrdmn opened this issue Apr 12, 2017 · 3 comments

Comments

@nrdmn
Copy link

nrdmn commented Apr 12, 2017

If there's a \t in a file name, the names' alignment in grid view breaks:

vagrant@exa:~/foo$ touch "`echo -e "h\th"`" aaaaa bbbbb ccccc ddddd eeeee fffff ggggg hhhhh iiiii jjjjj kkkkk lllll mmmmm nnnnn ooooo ppppp
vagrant@exa:~/foo$ exa
aaaaa  ccccc  eeeee  ggggg  hhhhh  jjjjj  lllll  nnnnn  ppppp
bbbbb  ddddd  fffff  h	h     iiiii  kkkkk  mmmmm  ooooo  
vagrant@exa:~/foo$ ls
aaaaa  ccccc  eeeee  ggggg  hhhhh  jjjjj  lllll  nnnnn  ppppp
bbbbb  ddddd  fffff  h?h    iiiii  kkkkk  mmmmm  ooooo

If there's a \n in a file name, grid view and lines view breaks:

vagrant@exa:~/foo$ touch "`echo -e "d\nd"`" aaaaa bbbbb ccccc ddddd eeeee fffff ggggg hhhhh
vagrant@exa:~/foo$ exa
aaaaa  bbbbb  ccccc  d
d  ddddd  eeeee  fffff  ggggg  hhhhh
vagrant@exa:~/foo$ exa -l
.rw-r--r-- 0 vagrant 12 Apr 13:06 aaaaa
.rw-r--r-- 0 vagrant 12 Apr 13:06 bbbbb
.rw-r--r-- 0 vagrant 12 Apr 13:06 ccccc
.rw-r--r-- 0 vagrant 12 Apr 13:06 d
d
.rw-r--r-- 0 vagrant 12 Apr 13:06 ddddd
.rw-r--r-- 0 vagrant 12 Apr 13:06 eeeee
.rw-r--r-- 0 vagrant 12 Apr 13:06 fffff
.rw-r--r-- 0 vagrant 12 Apr 13:06 ggggg
.rw-r--r-- 0 vagrant 12 Apr 13:06 hhhhh
vagrant@exa:~/foo$ ls
aaaaa  bbbbb  ccccc  d?d  ddddd  eeeee  fffff  ggggg  hhhhh
vagrant@exa:~/foo$ ls -l
total 0
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 aaaaa
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 bbbbb
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 ccccc
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 d?d
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 ddddd
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 eeeee
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 fffff
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 ggggg
-rw-r--r-- 1 vagrant vagrant 0 Apr 12 13:06 hhhhh

GNU ls addresses these problems by replacing \t and \n with ?

@lilyball
Copy link
Contributor

BSD ls also does the same thing. It appears that it replaces all control characters (including 0x7F) with ?.

@lilyball
Copy link
Contributor

Interestingly, it actually appears to depend on whether the output is a terminal. If I pipe the results through cat, it prints the actual filename without replacements. It's unclear why it would do that, and I'm gonna say exa probably shouldn't care if the output is a terminal.

@lilyball
Copy link
Contributor

Ah hah, there's a flag that controls this:

-q      Force printing of non-graphic characters in file names as the character `?'; this is the default when output is to a terminal.

@ogham ogham closed this as completed in 3ebc225 May 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants