aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorverdant <im@verdant.ee>2026-08-05 21:24:34 +0800
committerverdant <im@verdant.ee>2026-08-05 21:24:34 +0800
commit1e1cb4e2b948ce7d54999c7f62a444ccb41759c7 (patch)
tree260f27718acddd49d2e363f5fe6d6a3f04f035d1
parentceceeeb0590e4704fc95d27dbe8eb976d59d66dd (diff)
downloadsf-1e1cb4e2b948ce7d54999c7f62a444ccb41759c7.tar.gz
sf-1e1cb4e2b948ce7d54999c7f62a444ccb41759c7.zip
Add key handling for fm_rm
-rw-r--r--src/keys.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/keys.c b/src/keys.c
index 747e5c8..a49aa79 100644
--- a/src/keys.c
+++ b/src/keys.c
@@ -97,6 +97,25 @@ handling_keys(int ch, fm_info *i)
fm_rename(i);
break;
}
+ case 'd': {
+ char path[PATH_MAX] = {0};
+ size_t len = snprintf(path, sizeof(path), "%s/%s", i->cwd,
+ i->cur->items[i->cursor].name);
+
+ if (len >= PATH_MAX) {
+ die("Itmes length error");
+ }
+
+ if (fm_rm(path) == 0) {
+ need_redraw = true;
+ fm_getdir(i->cur, i->cwd);
+ } else {
+ log_write(LOG_ERR, "%s", strerror(errno));
+ }
+
+ break;
+ }
+
default:
return;
}