Technical Background of Interactive CLI of Ruby 2.7

Abstract

Ruby 2.7 will be released with new multiline IRB that uses a new input library Reline. I'll talk about the technical background of it.

Details

the history of terminal

The history of terminal that we're using daily started from hundreds of years ago. It was constructed by coded signals, typing system, and printing system. It was extended with complex printing system and escape sequence to control it. The protocol and its specifications are the base of “terminal” of computer today.

GNU Readline compatible features

GNU Readline has so many features that include emacs like editor, vi like editor, TTY controls, settings file, and macro. I'll talk about how I implemented it almost completely.

I8n support

There are so many character encodings in the world, especially in CJK due to historical reasons. All terminal applications must treat the characters correctly. But it's not easy to implement.

And Unicode has so complex specifications of “character”, it's constructed by codepoints, combining characters, and glue codepoints. It's very difficult to understand for non-CJK people so I'll try to explain it all by emoji.