neovim/neovim — pull request #1053 by fornwall (2014-08-07 23:41:33+00:00)
Title: [RFC] Use bracketed paste mode when available

Terminal bracketed paste mode is enabled by sending "\e[?2004h" to the terminal.

This causes pastes to start with "\e[200" and end with "\e[201~", which allows us to detect paste mode automatically.

At exit bracketed paste mode is stopped by sending "\e[?2004l".

This fixes issue #937, but is in an early state for feedback, especially regarding to:

1. Is it safe to send "\033[?2004h" and "\033[?2004l" to all/relevant xterm* terminal emulators? Most modern ones understands it, and old ones should ignore it due to it being a private mode CSI sequence AFAIK.

2. Is starttermcap() and stoptermcap() the right place to send "\033[?2004h" and "\033[?2004l"?

3. Parsing in vgetorpeek(): I'm not familiar with this code, so needs to be checked.

4. Interaction with 'pastetoggle': The parsing of the "\e[200~" and "\e[201~" in vgetorpeek() currently takes place after pastetoggle.