Backport of #8725 Fix so `@edit` works on windows with the default editor + line number is printed to the user when it is not passed to the editor.
Merge pull request #8748 from dhoegh/backport_of_#8725

Backport of #8725 Fix so `@edit` works on windows with the default editor.