Support bracketed paste mode

- As described in https://cirw.in/blog/bracketed-paste
- Example support in vim:
  - https://github.com/ConradIrwin/vim-bracketed-paste/blob/master/plugin/bracketed-paste.vim
  - http://vimdoc.sourceforge.net/htmldoc/term.html#raw-terminal-mode
- Required for e.g. ipython, via python-prompt-toolkit:
  - https://github.com/ipython/ipython
  - https://github.com/jonathanslenders/python-prompt-toolkit

Repro:
- Run `ipython` (version 6.2.1)
- Copy multiple lines of text and paste into ipython prompt, e.g.
```py
print(1)
print(2)
print(3)
```
- Before: first line would paste and run, and subsequent lines are lost
- After: all lines paste into single prompt
This commit is contained in:
Dan Brown
2017-10-30 00:26:50 -07:00
parent 8ece306dbe
commit 1dbcf70cee
7 changed files with 46 additions and 0 deletions
+6
View File
@@ -930,6 +930,9 @@ export class InputHandler implements IInputHandler {
this._terminal.viewport.syncScrollArea();
this._terminal.showCursor();
break;
case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
this._terminal.bracketedPasteMode = true;
break;
}
}
}
@@ -1100,6 +1103,9 @@ export class InputHandler implements IInputHandler {
this._terminal.viewport.syncScrollArea();
this._terminal.showCursor();
break;
case 2004: // bracketed paste mode (https://cirw.in/blog/bracketed-paste)
this._terminal.bracketedPasteMode = false;
break;
}
}
}