From f352eb8b3c442391d02f5644193499f13a5cda2d Mon Sep 17 00:00:00 2001 From: Steven Xu Date: Sat, 30 Dec 2023 01:22:29 +1100 Subject: [PATCH] feat: move a file to a new directory with its existing name, closes #35 --- lua/genghis.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/genghis.lua b/lua/genghis.lua index 20350b4..376158b 100644 --- a/lua/genghis.lua +++ b/lua/genghis.lua @@ -130,9 +130,12 @@ local function fileOp(op) -- VALIDATION OF FILENAME if not newName then return end -- input has been canceled + if newName:find("/$") then + newName = newName .. oldName -- use the new directory with the old name + end + local invalidName = newName:find("^%s+$") or newName:find("[\\:]") - or newName:find("/$") or (newName:find("^/") and not op == "move-rename") local sameName = newName == oldName local emptyInput = newName == ""