diff --git a/buffer.lua b/buffer.lua index ac41e2d..3fe5b74 100644 --- a/buffer.lua +++ b/buffer.lua @@ -334,7 +334,11 @@ function buffer.op_undo(b, sl) if sl.op == "del" then return b:bufins(sl, true) elseif sl.op == "ins" then - return b:bufdel(sl.ci+#sl-1, sl.cj+ulen(sl[#sl]), true) + if #sl == 1 then -- Insertion was limited to part of a single line + return b:bufdel(sl.ci+#sl-1, sl.cj+ulen(sl[#sl]), true) + else -- Insertion spanned multiple lines + return b:bufdel(sl.ci+#sl-1, ulen(sl[#sl]), true) + end else return nil, "unknown op" end diff --git a/ple.lua b/ple.lua index 3a95d79..addd666 100644 --- a/ple.lua +++ b/ple.lua @@ -727,7 +727,12 @@ function e.exiteditor(b) end if anyunsaved then local ch = readchar( - "Some buffers not saved. Quit? ", "[YNQynq\r\n]") + "Some buffers not saved. Quit? ", "[YNQynq\r\n\24]") + if ch == "\24" then -- ^X + msg("^X") + e.prefix_ctlx(b) + return + end if ch ~= "y" and ch ~= "Y" then msg("aborted.") return