Fix "Run Current Document" so that it uses shebang or correct file path
This MR addresses BUG 417778, which right now only sends the current file name to the terminal.
These changes will ensure that:
- if there's a shebang in the file, it will use that to run the file;
- if no shebang is given, then the file itself will be called from the terminal.
Plus, the file will be called with its full path, avoiding problems when the terminal is "out of sync" with the file's location. Finally, the newline character will be added just before sending the input to the terminal, so that the GUI popup will not have a random newline in its text.
What is missing is a popup or message that, if no terminal is open at the moment, tells the user that nothing will happen. I didn't know how to address that, and suggestions are more than welcome.