-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Fix windows delete, open file and other improvements #584
Conversation
✅ Deploy Preview for superfile canceled.
|
@@ -1,10 +1,11 @@ | |||
package internal | |||
|
|||
import ( | |||
"log/slog" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont know, but my IDE just did that automatically. Maybe there is some recommended ordering or something
@@ -18,7 +19,7 @@ import ( | |||
|
|||
// Create a file in the currently focus file panel | |||
func (m *model) panelCreateNewFile() { | |||
panel := m.fileModel.filePanels[m.filePanelFocusIndex] | |||
panel := &m.fileModel.filePanels[m.filePanelFocusIndex] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panel
and model
are huge objects, with 10K+ bytes in size. Better to minimise their copying
@@ -481,7 +477,7 @@ func (m *model) pasteItem() { | |||
if err != nil { | |||
errMessage = "paste item error" | |||
} else { | |||
// Todo : These error cases are hard to test. We have to somehow make the paste operations fail, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My ide automatically removed trailing whitespace. Not a bad thing though
8a780ec
to
211cc7d
Compare
} | ||
if editor == "" { | ||
func (m *model) openDirectoryWithEditor() tea.Cmd { | ||
// Todo : Move hardcoded strings to constants : "windows", and editors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes the wrong behaviour when we try to open directories with EDITOR - that user configure for text file.
For example if a MacOS user configured EDITOR=nano to edit text files, but if he wants to open the directory in Finder application(File explorer of MacOS), it will open the directory in nano, which is not expected.
211cc7d
to
7cbd083
Compare
// open is command for MacOS Finder | ||
editor = "open" | ||
} else { | ||
editor = "vi" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use vi instead of nano as default directory opener in linux. As nano cannot open directories, while using vi
you can do a basic exploration through directories
Will update the PR with dir_editor and file_editor option. |
…odel obj, prevent copy for panel object
…g directories with E
7cbd083
to
eb74ce0
Compare
eb74ce0
to
7a1d6ad
Compare
@@ -30,7 +30,7 @@ If you are a vim user, the default hotkeys may make you hate superfile. | |||
::: | |||
|
|||
superfile default hotkeys design concept: | |||
- All hotkeys that will change to files use `qctrl+key` (As long as you don't press ctrl your files will always be safe). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed typo
6debdb1
to
29f78fe
Compare
e36414d
to
76accdf
Compare
76accdf
to
a0bef35
Compare
@yorukot I have made all the documentation and config changes, and updated the PR with the successful testsuite run. |
LGTM thanks a lot! |
Used https://github.com/hymkor/trash-go, that works in windows
Fixes - #380 - Issue in delete
Fixes - #335 - Issue in delete
Fixes - #437 - Issue in opening files
Fixes - #415 - Crash while running spf with metadata=true without exiftools installed
Adds documentation for - #514, #561 - Paste not working.
Adds documentation for - #572 - cd_on_quit not working on windows.
Added
file_editor
anddir_editor
config optionsFixed nano being used as opening application for directory.
Fixed file editor being "" in windows ( added notepad )
Fix usage of EDITOR(env variable for opening files) while opening directories with E
Also fixes editor being empty in windows, Removed pass by value for model obj, prevent copy for panel object.
Test for windows delete
Also verified directory deletion
If you try to delete a directory where you lack permissions. This appears. Which is okay.
![image](https://private-user-images.githubusercontent.com/59679977/408812386-2d327d2e-b49a-477b-8409-47130e90fe7e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNjA2NjEsIm5iZiI6MTczOTE2MDM2MSwicGF0aCI6Ii81OTY3OTk3Ny80MDg4MTIzODYtMmQzMjdkMmUtYjQ5YS00NzdiLTg0MDktNDcxMzBlOTBmZTdlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA0MDYwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEyNjBiZGFkZDI2ZDc5MmUyZmM2OTBiNDdkMzc2YmZkOWMyMzZmYzYxNzEyYzdjMTZkNTJiMWM1NjE4YTMxMjMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.8SYKOoIZICV6-OG34jZvV7Iyq9z3Tp8h2lMp83gdvoU)
Successful test run in MacOS
Test run in Linux
Test run in windows
Validating that pressing
E
(Shift+e
) opened file explorer in windows, and finder in MacOS.Validated that paste worked with
ctrl+w