onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.35k stars 299 forks source link

Can't create folder/file from explorer when selected directory(project dir) is empty #2571

Open avucic opened 6 years ago

avucic commented 6 years ago

Oni Version:0.3.6 Neovim Version (Linux only): Operating System: Mac

Issue: Can't create folder/file from explorer when selected directory is empty. Only works when file or dir exists inside the directory

Expected behavior: type ctrl-e enter filename end then CR to create file

Actual behavior: CR doesn't trigger file/folder creation

Steps to reproduce:

oni-bot[bot] commented 6 years ago

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

CrossR commented 6 years ago

Just checked this and can reproduce it.

I think this might be due to the fact the cursor is on the top line : image

And the action isn't allowed/setup for there. This is the same in non-empty repos, but you are able to just scroll down and then add a new file.

Assumedly the top level isn't counted as part of the tree, so that some selection is failing, so the UI never appears.

akinsho commented 6 years ago

@CrossR as you point out there isn't a corresponding action for the top most node i.e. the container in the code, a solution for that could be to add that functionality to that node as exists for the others or I think personally what would be better would be to add a node which represents an empty state which a user can use as a jumping off point for adding a new file or folder similar to the open folder button in the explorer if no folder is selected as the workspace.