Dear all,
When parsing large amount of text from textmate2 to the terminal, it sometimes happens that strange parsing errors occur. Line breaks, white space, or symbols are arbitrarily not send correctly to terminal.
For example; this line in textmate: col <- ifelse(…
ended up like this in terminal: col <col <cse(...
Hence, whenever I want to run multiple lines of code, I end up with errors, which makes it very difficult to work with textmate in combination with terminal.
I use the following command to parse the selected text to the terminal:
#!/bin/bash [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
rawText="$(cat | sed 's/ / /g;')"
#rawText="`cat`"
osascript -e 'on run(theCode)' \ -e 'tell application "Terminal" to activate' \ -e 'tell application "Terminal"' \ -e 'do script theCode in window 1' \ -e 'end tell' \ -e 'end run' -- "$rawText”
Thanks for any help and advice!
On 2 Feb 2018, at 20:55, Martin Batholdy wrote:
When parsing large amount of text from textmate2 to the terminal, it sometimes happens that strange parsing errors occur. Line breaks, white space, or symbols are arbitrarily not send correctly to terminal.
Do you mean *parsing* or *pasting*?
If you mean *pasting*: when I have a temporary “script” in TextMate that I want to run in the current terminal I copy it to the clipboard and then in the terminal I run:
pbpaste|sh
This will run the script through the shell interpreter without issues like e.g. tab characters triggering expansion, or return triggering instant execution with potential reads from stdin that may swallow some of your script.
Dear Allan Odgaard,
I meant pasting, sorry.
I use a keyboard shortcut that executes the script that I sent earlier to transfer the selected text to the terminal. If that would properly work, it would make it very convenient, as I do not have to copy, switch windows and paste manually, but simply press one button.
When I copy the code manually, these pasting-errors do not happen. Also,no errors occur if I execute the script with smaller junks of text.
Do you know what the script is doing to the text, that especially a lot of code gets messed up during the process? like the col <- ifelse(… turning into col <col <cse(…
On 2. Feb 2018, at 15:29 , Allan Odgaard mailinglist@textmate.org wrote:
On 2 Feb 2018, at 20:55, Martin Batholdy wrote:
When parsing large amount of text from textmate2 to the terminal, it sometimes happens that strange parsing errors occur. Line breaks, white space, or symbols are arbitrarily not send correctly to terminal.
Do you mean parsing or pasting?
If you mean pasting: when I have a temporary “script” in TextMate that I want to run in the current terminal I copy it to the clipboard and then in the terminal I run:
pbpaste|sh This will run the script through the shell interpreter without issues like e.g. tab characters triggering expansion, or return triggering instant execution with potential reads from stdin that may swallow some of your script.
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Dear all,
One correction to my previous e-mail: Pasting it manually leads to the same scrambled letters when attempting to paste a lot of text.
Apparently, it is not an issue with textmate, but with terminal. This seems to describe my problem: https://gitlab.com/gnachman/iterm2/issues/3160 https://gitlab.com/gnachman/iterm2/issues/3160
Unfortunately, I have not found a fix for this behavior yet If anyone has experienced similar problems and found a workaround – I would highly appreciate it!
On 2. Feb 2018, at 15:58 , Martin Batholdy batholdy@googlemail.com wrote:
Dear Allan Odgaard,
I meant pasting, sorry.
I use a keyboard shortcut that executes the script that I sent earlier to transfer the selected text to the terminal. If that would properly work, it would make it very convenient, as I do not have to copy, switch windows and paste manually, but simply press one button.
When I copy the code manually, these pasting-errors do not happen. Also,no errors occur if I execute the script with smaller junks of text.
Do you know what the script is doing to the text, that especially a lot of code gets messed up during the process? like the col <- ifelse(… turning into col <col <cse(…
On 2. Feb 2018, at 15:29 , Allan Odgaard <mailinglist@textmate.org mailto:mailinglist@textmate.org> wrote:
On 2 Feb 2018, at 20:55, Martin Batholdy wrote:
When parsing large amount of text from textmate2 to the terminal, it sometimes happens that strange parsing errors occur. Line breaks, white space, or symbols are arbitrarily not send correctly to terminal.
Do you mean parsing or pasting?
If you mean pasting: when I have a temporary “script” in TextMate that I want to run in the current terminal I copy it to the clipboard and then in the terminal I run:
pbpaste|sh This will run the script through the shell interpreter without issues like e.g. tab characters triggering expansion, or return triggering instant execution with potential reads from stdin that may swallow some of your script.
textmate mailing list textmate@lists.macromates.com mailto:textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 3 Feb 2018, at 8:33, Martin Batholdy wrote:
Unfortunately, I have not found a fix for this behavior yet If anyone has experienced similar problems and found a workaround – I would highly appreciate it!
How about writing the text to a temporary file and then execute the file in terminal?
You could do this with local echo enabled (`set -x` for bash) so you can see what is actually being executed.