Closed epitron closed 11 years ago
NOTE: This commit is a lot more readable in WORD-diff mode: https://github.com/epitron/coolline/commit/533d4f7aee8dac8507fb63e408141b26baa5e3c6?w=1
Sweeeeet.
I think I might have reintroduced one issue I have here.
The problem with IO#read
is that it reads a single /byte/, which causes
encoding issues when the user inputs multibyte characters.
I'm not sure how to get both issues fixed (or if IO#getch
still makes those
syscalls every time if the input is already in raw-mode)
EDIT:
I just realize I can just use IO#getc
. This shouldn't reintroduce your problem.
Good old IO
! :+1:
IO#getch replaced with IO#raw to make ALT-keys and arrow-keys work in VTE (Any keys which send more than 1 character to the terminal were getting the 2nd and/or 3rd characters dropped.
After investigation, I figured out that IO#getch was using system calls to initialize/deinitialize raw mode EVERY time you called it. This introduced enough delay that it would miss some characters.
KDE's konsole didn't have this problem because it emulates a 9600 baud modem, but VTE-based terminals, like gnome-terminal, guake, and xfce4-terminal send all the characters immediately.
The solution was to just initialize raw mode once with IO#raw, and only deinitialize it after the user was finished with readline.
This should fix pasting problems in VTE as well.)