-
Notifications
You must be signed in to change notification settings - Fork 317
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
Update file permissions when returning from shell #1213
Conversation
Not sure why, but running app.ui.loadFile(app, true) here will not refresh the file information for the currently selected file, but selecting a different file and going back to the first one, will update the correct information. This commit adds the same code that is executed when the user manually runs the reload command, but for some reason it does not behave the same way. Im a bit clueless as to why. |
app.ui is not yet loaded at this point
When returning from the shell, the file information that will be printed in the prompt are no longer valid, so we need to reload them.
Ok, I think I got this fixed. This will now refresh the file information during the "draw" function before executing ui.drawPromptLine(nav) With this the file stats (like permissions) for the currently selected file are updated to reflect possible changed made on the shell (inside lf, e.g. by pressing w) While this seems to work, I cannot say with confidence that I understand most of the things lf does in these functions, so there may be a better way to implement this. A closer review of this and possible side effects would be advised. |
@bluesuncat I don't think it is a good idea to
|
At the moment, the reload is only executed when returning from an interactive shell. However, I still think that there is another issue and a better fix here. While this patch would reflect permission changes, changes like adding/deleting files seems to be ignored only for the current pane. To demonstrate: Now I press 'w' to get a shell and run 'rm -rf ../* to delete all files starting with the parent directory. Then I exit the shell to return to lf in this state: As mentioned, I don't quite get how this works, but there obviously is a function that updated to parent and child pane of the current path to reflect file changes but the current path is unaffected. I assume this is a bug on its own and for the current path the "updatefilechanges" function is missing. But since it works without a reload, this is where the changes in file permission could probably also be fixed. |
There is a better and more complete solution to be found (hopefully) |
Fixes #1172