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
+14
View File
@@ -66,4 +66,18 @@ describe('InputHandler', () => {
assert.equal(terminal.options['cursorBlink'], false);
});
});
describe('setMode', () => {
it('should toggle Terminal.bracketedPasteMode', () => {
let terminal = new MockInputHandlingTerminal();
terminal.prefix = '?';
terminal.bracketedPasteMode = false;
let inputHandler = new InputHandler(terminal);
// Set bracketed paste mode
inputHandler.setMode([2004]);
assert.equal(terminal.bracketedPasteMode, true);
// Reset bracketed paste mode
inputHandler.resetMode([2004]);
assert.equal(terminal.bracketedPasteMode, false);
});
});
});