Conversation
cb57eae to
c9262ea
Compare
ima1zumi
left a comment
There was a problem hiding this comment.
Paste is now very fast! Thanks!
|
|
||
| def self.set_bracketed_paste_key_bindings(config) | ||
| [:emacs, :vi_insert, :vi_command].each do |keymap| | ||
| config.add_default_key_binding_by_keymap(keymap, START_BRACKETED_PASTE.bytes, :bracketed_paste_start) |
There was a problem hiding this comment.
q: Bracketed paste doesn't seem like a keybinding since it's sent from the terminal, not the user. Why is it set here?
There was a problem hiding this comment.
Bracketed paste start sequence \e[200~ is very similar to some keys: kf9=\E[20~, knp=\E[6~, kpp=\E[5~.
We can't distinguish them until we read the 5th or 6th bytes. So treating them as same as keybinding is one of the simple way to implement it.
We can think key bindings (processed in class KeyStroke) as a transformation layer of byte stream (includes many kind of escape sequences) to meaningful symbols.
There was a problem hiding this comment.
Good point. It's similar to the terminal capabilities. Your explanation that it deals with byte streams made sense. Thanks!
Closes #631
Description
Implemented bracketed paste. Directly inserts pasted text.
This will speedup paste (1100 lines in 8sec → 2600 lines in 8sec)
Stops tab-complete while pasting code that includes tab
Code using tab indentation can be pasted to reline
Bracketed paste implementation
Reline had a code for bracketed paste but it seems not working.
(Escape sequence for bracketed paste start and end was also wrong)
Readline compatibility
Readline(>= 8.1) enables bracketed paste by default.
set enable-bracketed-paste offwill disable it.Readline accepts bracketed paste input
"\e[200~text\e[201~"even if it's disabled in inputrc.inputrc read
Changed inputrc read timing. Reline should read inputrc before
io_gate.prep