On bash, the editor receives ^C and ignores the signal properly. On execline, foreground receives ^C and closes the whole script, maybe causing me to lose the work done so far.
execline was not designed to handle interactive scripts: you need some extra tooling in the presence of job control. Your problem here is that you have an interactive program, editor, that can receive job control commands while running in the same process group as the whole script, so job control commands, which send signals to the process group, affect the whole script instead of just the editor process. You need to run editor in another process group (or another session). To achieve that, replace "foreground { editor ${file} }" with "foreground { setsid editor ${file} }". That will create a new session for editor to run in. If you have s6 installed, you can also use s6-setsid -g instead - that will create a new process group without creating a new session. Hope this helps, -- Laurent