gnachman/iTerm2 — pull request #167 by bdpdx (2014-03-20 05:14:14+00:00)
Title: Added Edit > Paste Special > Paste with Literal Tabs

Why this patch?

I often like to paste here docs from shell scripts into the terminal window to create files from the command-line. For example, a shell script might contain:

```
cat > output.txt << EOF
some text
some more text with a [tab] here and [tab] here too!
EOF
```

Without explicitly disabling bash's tab completion feature, either with something like ...

```
bind '\C-i:self-insert'
# do something
bind '\C-i:complete'
```
or
```
bash --noediting
# do something in a subshell
```

... it's impossible to paste the above heredoc (or any text containing tabs).

Bash does support entering literal tab characters if one first presses CTRL-V then tab.

That's what this command does: it prepends a CTRL-V character (ASCII SYN) to all tabs in the text to be pasted. This allows copy/paste to work naturally and you don't have to explicitly shut off tab completion in bash before you start pasting.

-------------------

Also in this patch:

* A fix for the "Paste Selection Escaping Special Characters" command. It didn't work at all owing to the fact that NSMenuItem's tag attribute wasn't being passed down to the pasteString:flag: method.

* Help documentation is updated.

* Removed the "Alternate" attribute from the "Paste Escaping Special Characters" NSMenuItem in MainMenu.xib as it wasn't actually being used.

Other things I noticed that are bugs to be fixed at some other time:

* The command key sequence shift-option-cmd-v which MainMenu.xib binds to "Paste Escaping Special Characters" causes problems. It seems also to be bound (in code?) to a dialog for choosing a split pane profile.

* The Toolbelt's Paste History window does not correctly handle formerly paste-special'ed text, owing partially to the fact that it trims whitespace and also that it doesn't retain the paste command that initiated the paste.

Signed-off-by: Brian Doyle