fix: new file w/o input uses "Untitled" as name

remotes/origin/HEAD
pseudometa 2023-03-27 12:45:22 +02:00
parent 2daec5dbd1
commit 67b663daa0
1 changed files with 4 additions and 1 deletions

View File

@ -64,7 +64,7 @@ local function fileOp(op)
local sameName = newName == oldName
local emptyInput = newName == ""
if invalidName or sameName or emptyInput then
if invalidName or sameName or (emptyInput and op ~= "new") then
if op == "newFromSel" then
cmd.undo() -- undo deletion
fn.setreg("z", prevReg) -- restore register content
@ -77,6 +77,9 @@ local function fileOp(op)
return
end
-- exception: new file creaton allows for empty input
if emptyInput and op == "new" then newName = "Untitled" end
-- DETERMINE PATH AND EXTENSION
local hasPath = newName:find("/")
if hasPath then