w3m icon indicating copy to clipboard operation
w3m copied to clipboard

Long filenames in parent directory cause screen cut off

Open jidanni opened this issue 4 years ago • 4 comments

Version: 0.5.3-38+b1

If the parent directory has long file names, the directory we are interested in will be shoved off the screen and cut off!

It should be the parent that gets cut off instead.

Even $ w3m -dump -cols 80 /tmp/orphan/ has no effect.

Here assume the user has an 115 character wide terminal:

Location: file:///tmp/orphan/
Directory list of /tmp/orphan/

------------------------------------------------------------------------------------------------------------------
/                                                                                   |
+-bin                                                                               |
+-boot                                                                              |
+-cf                                                                                |
+-dev                                                                               |
+-etc                                                                               |
+-home                                                                              |
+-lib                                                                               |
+-lib64                                                                             |
+-lost+found                                                                        |
+-media                                                                             |
+-mnt                                                                               |
+-music                                                                             |
+-opt                                                                               |
+-proc                                                                              |
+-root                                                                              |
+-run                                                                               |
+-sbin                                                                              |
+-srv                                                                               |
+-sys                                                                               |
o-tmp                                                                               |
| +-.ICE-unix                                                                       |
| +-.Test-unix                                                                      |
| +-.X11-unix                                                                       |
| +-.XIM-unix                                                                       |
| +-.font-unix                                                                      |
| o-orphan                                                                          |/tmp/orphan/
| +-ssh-mLbQjc4hnc80                                                                |[DIR]       320 Nov  2 00:46 .|
| +-systemd-private-ef0183bf921449eaa8535d5017397ff9-systemd-logind.service-Y48xSf  |[FILE]    27016 Nov  2 00:46 a|
| +-systemd-private-ef0183bf921449eaa8535d5017397ff9-systemd-resolved.service-m0tVNh|[FILE]    48572 Nov  2 00:46 a|
+-usr                                                                               |[FILE]     1985 Nov  2 00:46 d|
+-var                                                                               |[FILE]      661 Nov  2 00:46 e|
                                                                                    |[FILE]     9491 Nov  2 00:46 e|
                                                                                    |[FILE]     1030 Nov  2 00:46 e|
                                                                                    |[FILE]     1168 Nov  2 00:46 i|
                                                                                    |[FILE]    10471 Nov  2 00:46 l|
                                                                                    |[FILE]     7654 Nov  2 00:46 o|
                                                                                    |[FILE]   101529 Nov  2 00:46 r|
                                                                                    |[FILE]    45900 Nov  2 00:46 r|
                                                                                    |[FILE]   199012 Nov  2 00:46 r|
                                                                                    |[FILE]    85178 Nov  2 00:46 r|
                                                                                    |[FILE]      846 Nov  2 00:46 s|
                                                                                    |[FILE]      386 Nov  2 00:46 s|


jidanni avatar Nov 01 '20 20:11 jidanni

Well you can view the right panel by moving your cursor there. That said, displaying long file names is indeed annoying so I checked what could be done about it. The maximum length of the left panel could be set to 40:

[...]
|   | o-w3m                             │
|   | | o-.dirtest                      │
|   | | | o-asdf                        │/home/user/Documents/w3m/.dirtest/asdf/
|   | | |   +-verylongdirectorynameforte│[DIR]      4096 Nov  6 16:40 ../
|   | | +-.git                          │[DIR]      4096 Nov  6 16:41 verylongdirect
|   | | +-.js-patch                     │
|   | | +-.testing                      │
|   | | +-Bonus                         │
|   | | +-Symbols                       │
|   | | +-autom4te.cache                │
|   | | +-doc                           │
|   | | +-doc-de                        │
|   | | +-doc-jp                        │
|   | | +-libwc                         │
[...]

But you can't display less than one characters, so if you are twenty directories deep in your filesystem, the left panel will start expanding but certain folders will still be displayed with a trimmed name (the left panel is displayed recursively, so we can't know what the maximum length is until it's displayed). Or after a while you could also stop moving the expanded directories to the right, but then it's harder to see where new directories begin. So I don't know what the best way to solve this would be.

bptato avatar Nov 06 '20 17:11 bptato

Well, e.g., lynx only shows the final target directory. OK, so you could first place the target directory on the screen. Then if there is any room remaining, you could squeeze a partial tree view in to the remaining area on the left...

jidanni avatar Nov 07 '20 22:11 jidanni

Well, e.g., lynx only shows the final target directory.

w3m can do that too, at the top of the buffer you can change the Type dropdown list to Standard.

OK, so you could first place the target directory on the screen. Then if there is any room remaining, you could squeeze a partial tree view in to the remaining area on the left...

That could be done, preferably without the path displayed since then the tree would be pushed out of the screen far too quickly. And the path is displayed at the top of the screen anyways. Then the left panel would not be expanding at all and the right one only one character per directory. Even better, we could change it so deeper directories are displayed first, then only those would be pushed out that the user likely doesn't care about anyways. But again that might be a challenge because the tree is displayed recursively... either way, I'll look into it.

bptato avatar Nov 07 '20 23:11 bptato

Related Debian BTS bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=370581

rkta avatar Dec 22 '22 15:12 rkta