rc autorestore: fix regression due to ! breaking change

Commit 85b78dda (src: Select the data inserted by `!` and `<a-!>`,
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 <space> commands from execute-keys, to make
it work on the breaking-cleanups branch which swaps <space> and ",".

Closes #4335
This commit is contained in:
Johannes Altmanninger 2022-04-24 19:56:32 +02:00
parent ceaac1c400
commit 52a7c58670

View File

@ -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<space>\"${newer}\"<ret>d }
execute-keys -draft %{%d!cat<space>\"${newer}\"<ret>jd}
## If the backup file has to be removed, issue the command once
## the current buffer has been saved