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

TUI: Modification when the path cannot be restored or if there a name colission #45

Open
AmineZouitine opened this issue May 13, 2023 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@AmineZouitine
Copy link
Owner

AmineZouitine commented May 13, 2023

Currently, when a user tries to restore a deleted file from the TUI, if there is a name collision or if the path cannot be restore the following message appears:

Unfortunately, Path /home/amine/perso/rmt.rs doesn't exist anymore or there is a file with the same name inside, so we can't restore your element to the original path :c
Please enter a new absolute path to restore your element
>> /home

This message is unclear and impractical.

I propose the following idea: when a path is not resolvable or there is a name collision, an interactive file tree should be displayed, allowing the user to navigate using Vim-like commands (j for down, k for up), and using the spacebar to open or close folders (folders are closed by default).

When the user selects a folder by pressing Enter, if the original name doesn't exist, it should be placed in the chosen folder. If there is a collision, the user should be prompted to enter a new name.

Bonus: Use emojis to visually represent files and folders.

Here's an example of how it could look in the shell:

📁 home
  📁 name
  >  📁 perso
      📄 rmt.rs
  📁 other_folder
  
  
  ↑/k up • ↓/j down • esc filter • ctrl(d) clear filter • space open/close folder • enter validation • q exit
@AmineZouitine AmineZouitine added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels May 13, 2023
@AmineZouitine AmineZouitine changed the title GUI: Modification when the path cannot be restored or if there a name colission TUI: Modification when the path cannot be restored or if there a name colission May 13, 2023
@lanius412
Copy link
Contributor

If there is the same name file,
change restore file name to [defalut_name]_1.[ext] like tmp_1.txt

if new file name is exists, do increment suffix num

@AmineZouitine
Copy link
Owner Author

Good idea !

@lanius412
Copy link
Contributor

curretly, restorable conditions is
・exists restore item's parent dir
・doesnot exist the same restore item name

Path::new(&trash_item.path).is_dir() && !Path::new(&element_path_name).exists()

For restore item that there is same name item in the same directory, automatically restored with a suffix.

But,
What about restore item for which no parent directory exists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants