From 52a7c58670bb5e891b535a8d72187490c2ee7d37 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 24 Apr 2022 19:56:32 +0200 Subject: [PATCH] rc autorestore: fix regression due to ! breaking change Commit 85b78dda (src: Select the data inserted by `!` and ``, merged on 2021-03-06) broke autorestore by making it delete the restored content. I've been using it for 6 months but never noticed since I didn't use autorestore Reproducer: HOME=$PWD kak -s foo README.asciidoc -e 'exec iUNSAVED-CONTENT' # In another terminal: ps aux | awk '/kak -s foo/ {print $2; exit}' | xargs kill -HUP HOME=$PWD kak -s foo README.asciidoc Delete the trailing newline instead of the restored content. While at it, remove some commands from execute-keys, to make it work on the breaking-cleanups branch which swaps and ",". Closes #4335 --- rc/tools/autorestore.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/tools/autorestore.kak b/rc/tools/autorestore.kak index d3e60994..52febe3a 100644 --- a/rc/tools/autorestore.kak +++ b/rc/tools/autorestore.kak @@ -39,7 +39,7 @@ define-command autorestore-restore-buffer \ ## Replace the content of the buffer with the content of the backup file echo -debug Restoring file: ${newer} - execute-keys -draft %{ %d!cat\"${newer}\"d } + execute-keys -draft %{%d!cat\"${newer}\"jd} ## If the backup file has to be removed, issue the command once ## the current buffer has been saved