Skip to content

Commit 1063c6b

Browse files
committed
1. Added some logic to the true delete command. Not 100% sure on implementation, definitely needs reviewed. However now, when a an item other than Confirm or Cancel is acted on, it is removed from the to be deleted list and then a new prompt is displayed for user confirmation.
1 parent c66b580 commit 1063c6b

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ test.py
33
__pycache__/
44
Thumbs.db
55
.DS_STORE
6-
*.sublime-project
7-
*.sublime-workspace
6+
*sublime-project
7+
*sublime-workspace

FMcommands/delete.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ def delete(self, index):
1818
"Unable to send to trash: {}".format(e))
1919
raise OSError(
2020
"Unable to send {0!r} to trash: {1}".format(path, e))
21+
if index > 1:
22+
view = self.window.find_open_file(self.paths[index - 2])
23+
if view is not None:
24+
close_view(view)
25+
26+
# We substract two, because 0, 1 are populated by Confirm, Cancel
27+
self.paths.remove(self.paths[index - 2])
28+
29+
if self.paths:
30+
refresh_sidebar(self.settings, self.window)
31+
self.run(self.paths)
32+
2133
refresh_sidebar(self.settings, self.window)
2234

2335
def run(self, paths=None, *args, **kwargs):
@@ -45,7 +57,8 @@ def run(self, paths=None, *args, **kwargs):
4557
]
4658

4759
for path in paths:
48-
paths_to_display.append([path.split(os.path.sep)[-1], path])
60+
paths_to_display.append(
61+
[path.split(os.path.sep)[-1], path])
4962

5063
self.window.show_quick_panel(
5164
paths_to_display,

0 commit comments

Comments
 (0)