jarun / nnn

n³ The unorthodox terminal file manager
BSD 2-Clause "Simplified" License
19.41k stars 763 forks source link

ToDo list #386

Closed jarun closed 4 years ago

jarun commented 5 years ago

Rolled from #337.

For next release

Proposed features and tasks (up for grabs)

Anything else which would add value (please discuss in this thread).

List of completed features and tasks.

0xACE commented 4 years ago

Hey, I think i encountered the lastdir problem described in: https://github.com/jarun/nnn/commit/20ac9da98852367646e2c3b195fcbfee844cca72#commitcomment-36198570

appear in commit: f80563e16a981deeaca43e17b48dbf6ca0ed0efd

as I was on the run, I didn't have time to note which commit i was on when it happened, and since then I have rebased on master... I tried reproducing it though and I can't anymore, so I'm not sure if that build was spooked somehow...

jarun commented 4 years ago

I think it's fixed in master. Please try a few more times with the release.

0xACE commented 4 years ago

I tried again, it happened again. I'm not exactly sure how to reproduce it.

I can't reproduce it in a "testing" scenario, the problem appears when I'm using nnn naturally...

jarun commented 4 years ago

I am not sure how this helps. We had days to test this before the release and I did call out to all of you to pitch in. Your natural usage is not helping me to reproduce this.

jarun commented 4 years ago

@0xACE any luck yet? Please confirm you are on master.

jarun commented 4 years ago

@maximbaz can you please help us repro the issue @0xACE is seeing?

maximbaz commented 4 years ago

Will try, but after you pushed https://github.com/jarun/nnn/commit/ef88a31a7ce632f35b538ff64466489902076883 and https://github.com/jarun/nnn/commit/0a5dc2e336cfa3aab64783fb44b0be519e46750c I've had zero issues with selection. If I spot it, I'll let you know right away.

jarun commented 4 years ago

Yes, even I am not seeing this.

jarun commented 4 years ago

@0xACE I also took a look at master source to track if we are clearing lastdir anywhere but I couldn't find any such instance.

0xACE commented 4 years ago

I am not sure how this helps. We had days to test this before the release and I did call out to all of you to pitch in.

I did try it out in my limited time, and I don't recall that I encountered it

Your natural usage is not helping me to reproduce this.

Yeah, atm I don't have a way to describe it because I don't understand it myself.

@0xACE any luck yet? Please confirm you are on master.

Yes I am on master.

Will try, but after you pushed ef88a31 and 0a5dc2e I've had zero issues with selection. If I spot it, I'll let you know right away.

No need to push yourselves, I haven't confirmed it myself, I was mostly wondering if someone else is encountering this issue.

@0xACE I also took a look at master source to track if we are clearing lastdir anywhere but I couldn't find any such instance.

Yeah, I haven't looked at the code yet. As I don't know how to reproduce it, I'm just gauging if someone else has this problem.

I'll let you know next time I encounter the problem. For now there is not much I can do about it...

One thing both occurances had in common was that I selected a folder for a that was being downloaded via torrent. I left nnn running while that torrent was downloading, and when it finished, I went back to nnn to try to move the selected folder, and thats when I noticed the selected path was incorrect... But I'm not sure how that affects nnn...

jarun commented 4 years ago

One thing both occurances had in common was that I selected a folder for a that was being downloaded via torrent.

I'll try this.

jarun commented 4 years ago

And no luck! I've made the minor release already. If it's really an issue we will surely get user reports and we can fix it when we have some more concrete data.

0xACE commented 4 years ago

Happened again, this time there were no torrents involved.

I'm disabling all my personal patches just incase this problem is caused by my changes. I'll let you know next time...

Btw is it important to K flush the selection? because I have never used it, and I don't think I intend to use it...

jarun commented 4 years ago

Btw is it important to K flush the selection?

Not for flush, not really. Because of your use case, I made the flush to .selection file auto. But yes, it's required to edit.

jarun commented 4 years ago

@maximbaz can you check if there's any way to reduce the binary size further? For me it is 62.1 K now. I would love to bring it below 60 K.

maximbaz commented 4 years ago

I'll have a look, out of curiosity, can you share the full command that you use to compile?

If I run make locally, it executes the command below, resulting in 93kb file.

cc  -Wall -Wextra -O3 -D_GNU_SOURCE -D_DEFAULT_SOURCE   -o nnn src/nnn.c -lreadline -lncursesw

If I run make on the build environment for Arch Linux (this is what we distribute to users), make executes the command below, resulting in 87kb file.

$ cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -Wall -Wextra -O3 -D_GNU_SOURCE -D_DEFAULT_SOURCE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o nnn src/nnn.c -lreadline -lncursesw
jarun commented 4 years ago

here's what I see on Ubuntu 18.04, amd64:

~/GitHub/nnn$ sudo make O_NORL=1 strip install
cc -DNORL -Wall -Wextra -O3 -D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw  -o nnn src/nnn.c -lncursesw -ltinfo
strip nnn
install -m 0755 -d /usr/local/bin
install -m 0755 nnn /usr/local/bin
install -m 0755 -d /usr/local/share/man/man1
install -m 0644 nnn.1 /usr/local/share/man/man1
~/GitHub/nnn$ ll nnn
-rwxr-xr-x 1 root root 63616 Dec 17 18:11 nnn*
~/GitHub/nnn$
jarun commented 4 years ago

@annagrram shall we remove the "@" session after we restore it? I think currently it's not happening. I don't remember if we talked about this during implementation.

annagrram commented 4 years ago

@annagrram shall we remove the "@" session after we restore it? I think currently it's not happening. I don't remember if we talked about this during implementation.

We haven't talked about it, but yeah. Sure

jarun commented 4 years ago

I have checked-in the change already at commit cf388649b9cd6fba38b9c0dca49c29bad3b6f737. Please review once.

0xACE commented 4 years ago

Just a quickie: I tried opening a file which had a ' in it: example This Boy's Life with ^o (CTRL-o) and it failed to open it. anyone else having problems with this?

jarun commented 4 years ago

which application did you try to open it with?

0xACE commented 4 years ago

which application did you try to open it with?

a personal tool i made. But nvm, I can't reproduce the error anymore. I thought maybe i misspelled my tool, but looking at the history, i did write it in correctly.

Anyhow, since I can't reproduce it, it's most likely a user error on my end and not nnn related.

KlzXS commented 4 years ago

On the other hand is anybody experiencing "swallowing of input", i.e. after ^o if you try to open a cli program as gui (it seems to not work for every program but for vim it does), every second keypress doesn't do anything. This also persists even after exiting nnn until the terminal is closed. Also affects ttys.

jarun commented 4 years ago

if you try to open a cli program as gui

please don't do this. It will mess up your terminal. Open a CLI program as cli and GUI program as gui. I don't think we will be able to support the inter-mixing with any kind of hacks. We can't detect ourselves whether a executable is GUI or CLI.

@0xACE

Is the tool a cli-only opener? or does it invoke a gui program?

KlzXS commented 4 years ago

please don't do this

This time I did it on accident but I think this also happens sometimes with some files when it doesn't know with what to open it. At least it did in the past. Just by using l, Enter.

jarun commented 4 years ago

What's your opener?

If it's a text file do you have NNN_USE_EDITOR set?

0xACE commented 4 years ago

Is the tool a cli-only opener? or does it invoke a gui program?

It's a cli only tool. It has no GUI elements involved.

I reckon it's safe to dismiss my "error". There is a good chance I actually made a mistake. As this problem appeared in my "regular" usage of nnn I didn't think to debug it, and by the time i "realised" that there might be wrong, I had already closed the window. Since none of use can replicate it atm, maybe it really was me making a mistake.

Btw regarding the cli vs gui prompt in ^o: I always thought that in the ^o context that gui was just a cover up for running the process in the background.

jarun commented 4 years ago

I always thought that in the ^o context that gui was just a cover up for running the process in the background

There's more to it. For gui programs, we do not wait and we also disable their stdout and stderr. Some UGI programs write debug and errors to stdout/stderr. That breaks the nnn interface.

In case of CLI programs, we spawn them, wait and also show their output.

maximbaz commented 4 years ago

@jarun regarding executable size, I was searching how to get the most significant results and discovered compression tool called upx.

On my local machine, upx --best nnn compresses the nnn binary from 79904 bytes down to 39960 bytes!

Do you know about this tool? Any drawbacks in using it?

KlzXS commented 4 years ago

Some basic disadvantages listed are:

  • Special permissions are ignored, such as suid.
  • argv[0] will not be meaningful.
  • Multiple running instances of the executable are unable to share common segments.

Not sure if we really care about those. But it does sound cool.

jarun commented 4 years ago

@maximbaz

Do you know about this tool? Any drawbacks in using it?

But we would have to unpack it each time when we load, right?

jarun commented 4 years ago

Let's leave that. strip is good enough. We should try to see from code perspective if we can do something.

awsdert commented 4 years ago

I saw on the linuxquestions site that you were looking for feature suggestions, personallyy I rather liked the grouping mechanism that windows explorer has and find it annoying that no linux file manager has that feature, perhaps you could lead the charge and implement one? Doesn't have to be on by default but by golly it makes manual searches easier

jarun commented 4 years ago

Can you explain grouping? I seldom use Windows.

annagrram commented 4 years ago

Can you explain grouping? I seldom use Windows.

Me too. But a quick YouTube search yielded this: https://youtu.be/k_mlcPonzGo?t=485

jarun commented 4 years ago

Thanks @annagrram!

As I can see, there are 4 grouping params: name, modification date, type, size. We support all 4 (and more).

@awsdert please press d to enable detail mode and use the respective sort keys to show the files ordered in the way.

default is by name, so look for the order in the file name column. For date, use the first column, for size see the size column.

Type in case of nnn would be extension. So order by extension and I think in this case the light mode would be helpful as you may want to see the full name. Note that we also show the extension in the status bar.

For example, this is what I see in plugins dir when I sort by mod time:

 2020-01-07 22:11  664     9.3K  README.md
 2020-01-06 19:26  775     428B* autojump*
 2020-01-06 19:26  775     928B* boom*
 2020-01-06 19:26  775     661B* fzcd*
 2020-01-06 19:26  775     896B* fzhist*
 2020-01-06 19:26  775     588B* fzopen*
 2020-01-06 19:26  775     1.4K* getplugs*
 2020-01-06 19:26  775     619B* imgview*
 2020-01-06 19:26  775     1.1K* launch*
 2020-01-06 19:26  775    15.8K* nuke*
 2020-01-06 19:26  775     770B* pskill*
 2020-01-06 19:26  775     780B* upload*
 2020-01-01 00:23  775     2.1K* chksum*
 2020-01-01 00:23  775     1.2K* diffs*
 2020-01-01 00:23  775     1.8K* dragdrop*
 2020-01-01 00:23  775     539B* dups*
 2020-01-01 00:23  775     1.5K* gutenread*
 2020-01-01 00:23  775     184B* hexview*
 2020-01-01 00:23  775     771B* imgresize*
 2020-01-01 00:23  775     310B* imgthumb*
 2020-01-01 00:23  775    20.3K* imgur*
 2020-01-01 00:23  775     250B* ipinfo*
 2020-01-01 00:23  775     637B* kdeconnect*
 2020-01-01 00:23  775     254B* mediainf*
 2020-01-01 00:23  775     1.1K* moclyrics*
 2020-01-01 00:23  775     2.1K* mocplay*
 2020-01-01 00:23  775     1.4K* nmount*
 2020-01-01 00:23  775     318B* oldbigfile*
 2020-01-01 00:23  775     1.4K* organize*
 2020-01-01 00:23  775     733B* pdfread*
 2020-01-01 00:23  775     615B* pdfview*
 2020-01-01 00:23  775     606B* picker*
 2020-01-01 00:23  775       1K* renamer*
 2020-01-01 00:23  775     942B* ringtone*
 2020-01-01 00:23  775     1.3K* splitjoin*
 2020-01-01 00:23  775     408B* suedit*
 2020-01-01 00:23  775     139B* treeview*
 2020-01-01 00:23  775     208B* uidgid*
 2020-01-01 00:23  775     658B* upgrade*
 2020-01-01 00:23  775     559B* vidthumb*
 2020-01-01 00:23  775     835B* wall*

And the date column gives me the grouping in a quick glance. I think when you are looking for a specific filename you still need to look into the filename both in Windows and in nnn.

If you are looking for the specific horizontal line kind of separation, that will not be possible without a major view overhaul (and conditional checks in the sorted entries as well). I don't think the ROI is great with what we already have today.

ghistes commented 4 years ago

It would be a nice feature to display the mime-type of a file in the detail-view as this information is need to configure applications for the file-openers. The mime-type is already determined when a file is edited, so I guess it would be easy to add.

ghistes commented 4 years ago

When does the version-number change? I have nnn both from the debian-repository and compiled the head myself. Both display 2.8.1 as versions but they behave diffferently (eg toggle of execution-flag does not exist in the debian version).

jarun commented 4 years ago

The mime-type is already determined when a file is edited

Only if NNN_USE_EDITOR is set and only when we open/edit it. But not when rendering file info as that would need calling file on all listed files affecting performance.

I am inclined to show it in the status bar for the current file but some of the mime types can be quite lengthy and will push out vital info.

as this information is need to configure applications for the file-openers

As this is an infrequent operation, how about showing it in the file details screen? I think even today we invoke file there.

jarun commented 4 years ago

When does the version-number change?

Just before making the release. So master is still at 2.8.1 we changes on top of last-released v2.8.1.

ghistes commented 4 years ago

Showing the mime-type in the file details screen for the current file only is what I meant.

jarun commented 4 years ago

Mime type shown at commit 5cb39b0db36a4afd30a0578799cd85dc28ed153c. ;)

ghistes commented 4 years ago

perfect.

ghistes commented 4 years ago

What I would like to have is way to reverse the sorts. So when I press "z" the entries are sorted by size, decending. I would like to press maybe "Z" and have the entries sorted by size but ascending.

Unfortunately such a logic currently cannot be extended as sort by extension is "E" while "e" is edit, but it seems you are currently discussing key-bindings anyway, so maybe it would be worth it to make some changes to have a general approach in the form that descending sorts have lower-case letters and the corresponding ascending sort has the upper-case letter or something like that...

KlzXS commented 4 years ago

Why would we have a keybind for reverse sort for every sorting mechanism? Why not have a single key that reverses the sort independent from which mechanism you are using?

ghistes commented 4 years ago

If that is possible it would be even better.

ghistes commented 4 years ago

"nnn -z" does not seem to work. Is there a way to set the preferred sort mode on the command-line? If not, that would also be nice to have.

jarun commented 4 years ago

Reverse has been discussed earlier. Please see issue #377. My stand hasn't changed on this one. It's trivial to rollover at an edge or press G to jump to the last file and see in reverse.

jarun commented 4 years ago

"nnn -z" does not seem to work.

There is no such option (try nnn -h). Only 2 sort orders (which are likely to be set constantly) are available - -v and -S.