julia
f87bc8d9 - Rf/autoindentpaste improvements (#30755)

Commit
6 years ago
Rf/autoindentpaste improvements (#30755) * REPL: disable auto-indent when code is likely being pasted (fix #25186) On some Windows terminals, pasting is not recognized as such. This happens also with tmux' builtin paste. In those cases, auto-indent is better disabled, as we want to preserve the original indentation of the code being pasted. This fix is quite a hack, but seems to work: using time(), if the next character after a newline is being inserted very fast, assume this was with paste, and cancel the insertion of the spaces done by auto-indent. I couldn't insert two characters in a raw within less than about 0.03 or 0.02 seconds, so the threshold for "very fast" is set to 0.0005, but this is an option which can changed. * fix tests * more reliability * don't include refresh_line in the timings * use a separate autoindent variable, as we want to undo indent in case of paste only for auto-indented code (although currently in the REPL code this function is never called with a positive argument) * Some improvements: autoident is now prevented and needs not to be redone. Paste of mixed space/tabs/empty lines is now more reliable. * fixed bug where indent is set externally
Author
Committer
Parents
Loading