local function fn(config, deck, _, ip) local sp = deck[ip[1]][ip[2]] local rt = sp:spt() local fname = "memoire_cc.tmp" local fh = io.open(fname, "w") fh:write(rt) fh:close() os.execute(string.format( "%s %q", os.getenv("EDITOR") or "vi", fname )) fh = io.open(fname, "r") local nt = fh:read("a"):gsub("%s+$", ""):gsub("^%s+", "") fh:close() os.remove(fname) if nt ~= sp:spt() and nt ~= "" then local cardrec = Prompt:torec(deck[ip[1]]) cardrec.PromptText = { nt } deck[ip[1]] = Prompt:fromrecs({ cardrec }, config)[1] return deck end end return { desc = "(c)orrect card (with card:prompt index)", nd = true, ni = true, fn = fn }