Rabbit Slide Show

IRB Reboot: Modernize Implementation and Features

2019-04-18

Description

Text

Page: 1

Terminal Editors
For
Ruby Core Toolchain
ITOYANAGI Sakura
RubyKaigi 2019 Fukuoka
Powered by Rabbit 2.2.1 and COZMIXNG

Page: 2

Greeting
Hello, everyone!

Page: 3

Greeting
Welcome to Fukuoka, Japan!

Page: 4

Let me introduce myself
I'm
a RDoc maintainer
a Ruby committer
a member of Ruby core
team

Page: 5

Let me introduce myself
I'm so tired because this is
first session just after keynote.

Page: 6

Let me introduce myself
Dark green area is Kyushu

Page: 7

Let me introduce myself
RubyKaigi venue is Fukuoka

Page: 8

Let me introduce myself
I was born at Nagasaki

Page: 9

Let me introduce myself
How strange shape the arrows are

Page: 10

Let me introduce myself
Both are almost the same culture
area

Page: 11

Let me introduce myself
Both eat tonkotsu ramen

Page: 12

Let me introduce myself
Black Mont Blanc

Page: 13

Let me introduce myself
This is the greatest soul food of
Kyushu people

Page: 14

Let me introduce myself
White ice cream is covered black
chocolate and crunchy chips in
perfect balance

Page: 15

Let me introduce myself
All children in Kyushu are raised
on Black Mont Blanc and
everyone love it, Black Mont
Blanc is nice so Kyushu is nice

Page: 16

Community: Asakusa.rb
Asakusa.rb is holding every
Ruby Tuesday

Page: 17

Community: Asakusa.rb
Many speakers of RubyKaigi
2019 are from Asakusa.rb

Page: 18

Company:
Space Pirates, LLC.
#
#
#
#
#
#
#
#
image
src = space-pirates-logo.svg
relative-height = 70
caption = Space Pirates, LLC.
relative-padding-top = 0
relative-padding-bottom = 0
relative-padding-right = 0
relative-padding-left = 0

Page: 19

Company:
Space Pirates, LLC.
#
#
#
#
#
#
#
#
image
src = space-pirates-logo.svg
relative-height = 70
caption = I'm an Elasticsearch specialist in this company
relative-padding-top = 0
relative-padding-bottom = 0
relative-padding-right = 0
relative-padding-left = 0

Page: 20

Company:
Space Pirates, LLC.
#
#
#
#
#
#
#
#
image
src = space-pirates-logo.svg
relative-height = 70
caption = I don't know Elasticsearch but I'm using kind of go with the mood
relative-padding-top = 0
relative-padding-bottom = 0
relative-padding-right = 0
relative-padding-left = 0

Page: 21

Hobby: climbing
And, my hobby is climbing.

Page: 22

Hobby: climbing
I always go climbing when
Ruby conferences.

Page: 23

Hobby: climbing
But I got an injured TFCC by hard training

Page: 24

Hobby: climbing
Camp in a gorge at last weekend

Page: 25

Hobby: climbing
It's a prosthetic finger for climbing

Page: 26

Hobby: climbing
Climbing with prosthetic finger

Page: 27

Hobby: climbing
Camp in a gorge at last weekend

Page: 28

Hobby: climbing
Camp in a gorge at last weekend

Page: 29

Hobby: climbing
This type of injury has so hard
problem, it's "I can't turn my
humerus".

Page: 30

Hobby: climbing
It's natural position of humerus

Page: 31

Hobby: climbing
It's typing position of humerus

Page: 32

Hobby: climbing
"I can't turn my humerus"
vs
Typing position with turning
my humerus

Page: 33

Hobby: climbing
I'm still getting over the injury
and I've gotten a lot better
now.

Page: 34

Hobby: climbing
But I couldn't turn my
humerus in the early days. It
is effectively sentencing a
programmer to death.

Page: 35

Hobby: climbing
In the severe situation, I felt I
had to choose.

Page: 36

Hobby: climbing
I should:
make a keyboard
make an editor

Page: 37

Hobby: climbing
I should:
make a keyboard
make an editor

Page: 38

Terminal
Editors
For
Ruby Core
Toolchain

Page: 39

Terminal Editors
For Ruby Core Toolchain
First, I got...

Page: 40

Terminal Editors
For Ruby Core Toolchain
TFCC injury

Page: 41

GNU Readline
Ruby has one big problem
when installing, it's about GNU
Readline.

Page: 42

GNU Readline
GNU Readline is a line editor
software. For example, you
always use it on shell.

Page: 43

GNU Readline
Ruby has readline standard
library, and it's based on GNU
Readline as a native library.

Page: 44

GNU Readline
If you build and install Ruby
without installing GNU
Readline as a linkable files:

Page: 45

GNU Readline
readline stdlib is nothing
Only "input" and
"backspace" are available
on IRB
Pry fails to launch

Page: 46

GNU Readline
It's a very sad situation and a
hard trap for beginners.

Page: 47

GNU Readline
And user including me needs
to re-build Ruby, it means I
need to type keyboard more.

Page: 48

GNU Readline
It's worst case for my wrist

Page: 49

GNU Readline
So I started to develop a GNU
Readline compatible library by
pure Ruby for Ruby core.

Page: 50

GNU Readline
I had a plan to explain
terminal technologies in this
session but now...

Page: 51

GNU Readline
Now, an unprecedented boom in
text editor.

Page: 52

GNU Readline
You can listen to terminal
techniques in this session
tomorrow.

Page: 53

GNU Readline
I developed Reline what is as
a GNU Readline
(almost)compatible library by
pure Ruby.

Page: 54

GNU Readline
Reline's development policies
are:
complete developing as
soon as possible
because GNU Readline has
insanely many features

Page: 55

GNU Readline
Reline's development policies
are:
Windows support by Win32
API
because it's best way to
support Windows

Page: 56

GNU Readline
Therefore Reline uses:
ANSI escape code on Unix
like OSs
Win32 API on Windows

Page: 57

GNU Readline
Therefore Reline uses:
ANSI escape code on
Unix like OSs
Win32 API on Windows

Page: 58

ANSI escape code
ANSI escape code is a
standard specification to
control the cursor location,
color, and other options on
terminal.

Page: 59

ANSI escape code
If a terminal supports ANSI
escape code, softwares control
unified escape code.

Page: 60

ANSI escape code
Example:
puts
puts
puts
"\e[31mred"
"\e[32mgreen"
"\e[34mblue"

Page: 61

ANSI escape code
Example:
puts "\e[31m"
puts "\e[32m"
puts "\e[34m"
+ "red"
+ "green"
+ "blue"

Page: 62

ANSI escape code
Example:
puts
puts
puts
#
"\e[31m"
"\e[32m"
"\e[34m"
^color spec
+ "red"
+ "green"
+ "blue"
^text

Page: 63

ANSI escape code
Output should be like this

Page: 64

ANSI escape code
Example:
print "\e[#{num}A"
# Cursor Up
print "\e[#{num}B"
# Cursor Down

Page: 65

ANSI escape code
Example:
print "\e[2K"
# Erase in Line

Page: 66

ANSI escape code
But ANSI escape code has
some problems:
there aren't many things to
be able do
some escape sequences
are very slow grievously

Page: 67

ANSI escape code
For example,
print "\e[6n"
# Device Status Report
is very slow.

Page: 68

ANSI escape code
If software uses Device Status
Report so many times, it
should slower by the by.

Page: 69

ANSI escape code
So terminal software with
ANSI escape code should be
devised within limited
operations.

Page: 70

GNU Readline
Reline uses:
ANSI escape code on Unix
like OSs
Win32 API on Windows

Page: 71

Win32 API
Fiddle what is for calling
functions inside .dll or .so
dynamic libraries is only one
solution for supporting Win32
API.

Page: 72

Win32 API
This is "Console Functions"
page URL of Win32 API.
↓↓↓
https://docs.microsoft.com/en-us/windows/console/console-functions

Page: 73

Win32 API
"Console Functions" is enough
to do that the same of ANSI
escape code.

Page: 74

Win32 API
GetStdHandle() for console handle
SetConsoleCursorPosition() is
for cursor up and down
GetConsoleScreenBufferInfo() is
for cursor position
blah blah blah

Page: 75

Hard work
It was so hard work to
complete.

Page: 76

Hard work
So I always do programming,
on a desk, on a bed, in trains,
in a bathroom, in a toilet...

Page: 77

Hard work
Sometimes I use computer on the floor

Page: 78

Hard work
I got right anterior cruciate ligament injury

Page: 79

Hard work
I got right anterior cruciate ligament injury

Page: 80

Unicode support
Multibyte characters of
Unicode has so complex
specifications:

Page: 81

Unicode support
combination plural bytes to one character
combination plural characters to one
grapheme cluster
character width depending on the
situation
blah blah blah

Page: 82

Unicode support
combination plural bytes to one
character
combination plural characters to one
grapheme cluster
character width depending on the
situation
blah blah blah
I'll omit to explain these 2
specs because of too complex.

Page: 83

Unicode support
combination plural bytes to one character
combination plural characters to one
grapheme cluster
character width depending on the
situation
blah blah blah

Page: 84

Unicode support
Some Unicode characters'
width are changed by the
situation, for example Cyrillic
alphabet.

Page: 85

Unicode support
I'll show 2 gnome-terminal
screenshot.

Page: 86

Unicode support
"Д" as a single width character

Page: 87

Unicode support
"Д" as a double width character

Page: 88

Unicode support
Both are the same strings, but
changed width of "Д"

Page: 89

Unicode support
The behaviour is based on
terminal software settings

Page: 90

Unicode support
How to resolve:
show in actuality and check
width and...
delete it before user
awakes, in an eye's blink

Page: 91

Terminal
Ninja!

Page: 92

Unicode support
Vim has a function,
may_req_ambiguous_char_width() ,
the comment of it says...

Page: 93

Unicode support
First, we move the cursor to (1, 0)
and print a test ambiguous character
\u25bd (WHITE DOWN-POINTING TRIANGLE)
and query current cursor position.

Page: 94

COOLEST
TECH
IN
2019

Page: 95

Unicode support
New headache comes, it's killing me

Page: 96

Unicode support
I ported it to Reline. Coolest
software.

Page: 97

Line editing implementation
Next, let me implement line
editing features to Reline.

Page: 98

Line editing implementation
These are key assigned
operations...

Page: 99

Line editing implementation
operation method list
ed_insert(key)
ed_quoted_insert(str, arg: 1)
ed_next_char(key, arg: 1)
ed_prev_char(key, arg: 1)
ed_move_to_beg(key)
ed_move_to_end(key)
ed_prev_history(key, arg: 1)

Page: 100

Line editing implementation
Oh, list is cut off in the
middle...

Page: 101

Line editing implementation
operation method list(smaller)
ed_insert(key)
ed_quoted_insert(str, arg: 1)
ed_next_char(key, arg: 1)
ed_prev_char(key, arg: 1)
ed_move_to_beg(key)
ed_move_to_end(key)
ed_prev_history(key, arg: 1)
ed_next_history(key, arg: 1)
ed_newline(key)
em_delete_prev_char(key)
ed_kill_line(key)
em_kill_line(key)

Page: 102

Line editing implementation
Ah...

Page: 103

Line editing implementation
operation method list(smallest)
ed_insert(key)
ed_quoted_insert(str, arg: 1)
ed_next_char(key, arg: 1)
ed_prev_char(key, arg: 1)
ed_move_to_beg(key)
ed_move_to_end(key)
ed_prev_history(key, arg: 1)
ed_next_history(key, arg: 1)
ed_newline(key)
em_delete_prev_char(key)
ed_kill_line(key)
em_kill_line(key)
em_delete_or_list(key)
em_yank(key)
em_yank_pop(key)

Page: 104

Line editing implementation
Too many

Page: 105

Line editing implementation
operation method list
(smallester)
ed_insert(key)
ed_quoted_insert(str, arg: 1)
ed_next_char(key, arg: 1)
ed_prev_char(key, arg: 1)
ed_move_to_beg(key)
ed_move_to_end(key)
ed_prev_history(key, arg: 1)
ed_next_history(key, arg: 1)
ed_newline(key)
em_delete_prev_char(key)
ed_kill_line(key)
em_kill_line(key)
em_delete_or_list(key)
em_yank(key)
em_yank_pop(key)
ed_clear_screen(key)
em_next_word(key)
ed_prev_word(key)
em_delete_next_word(key)
ed_delete_prev_word(key)
ed_transpose_chars(key)
em_capitol_case(key)
em_lower_case(key)
em_upper_case(key)
em_kill_region(key)
copy_for_vi(text)
vi_insert(key)
vi_add(key)
vi_command_mode(key)
vi_next_word(key, arg: 1)
vi_prev_word(key, arg: 1)
vi_end_word(key, arg: 1)
vi_next_big_word(key, arg: 1)
vi_prev_big_word(key, arg: 1)
vi_end_big_word(key, arg: 1)
vi_delete_prev_char(key)
ed_delete_prev_char(key, arg: 1)
vi_zero(key)
vi_change_meta(key)
vi_delete_meta(key)
vi_yank(key)
vi_list_or_eof(key)
ed_delete_next_char(key, arg: 1)
vi_to_history_line(key)
vi_histedit(key)
vi_paste_prev(key, arg: 1)
vi_paste_next(key, arg: 1)
ed_argument_digit(key)
vi_to_column(key, arg: 0)
vi_next_char(key, arg: 1)
search_next_char(key, arg)

Page: 106

Line editing implementation
GNU Readline features are:

Page: 107

Line editing implementation
emacs mode
kill-ring
yank, yank-pop
vi mode
argumented operations
combination of operation and motion
undo
setting files
key binding
macro
blah blah blah

Page: 108

It means
that I made
almost full
2 editors

Page: 109

Line editing implementation
Demonstration

Page: 110

Multiline
editor

Page: 111

Multiline editor
Today's description of this
session explains about
"Reidline".

Page: 112

Multiline editor
"Reidline" is authored for new IRB by keiju-san who
is Ruby's grandfather, it behaves as a multiline editor
like JavaScript console on browsers.
It had many technical problems but I've already solved
that when I implemented Reline.
So I helped to complete Reidline.

Page: 113

Multiline editor
Therefore, I improved Reline
for Reidline. It supports
multiline a few days ago!

Page: 114

Multiline editor
Stiffness of neck, shoulder, lower back

Page: 115

Multiline editor
There are 3 editors by Ruby

Page: 116

Multiline editor
And, I'm the current RDoc
maintainer. So I added new
feature that shows document
after completion.

Page: 117

Multiline editor
Demonstration

Page: 118

Multiline editor
I started development of
editor for my wrist, but crash
of my body is continued.

Page: 119

Multiline editor
Incredible situation.

Page: 120

Multiline editor
And, at 3rd day of RubyKaigi,
Ruby 2.7.0-preview1 will be
released, with Reline and
Reidline.

Page: 121

Multiline editor
So I should fix all bugs for the
day.

Page: 122

Multiline editor
My body will be gone

Page: 123

Multiline editor
This is my last work of Heisei era

Page: 124

Multiline editor
C'mon, Reiwa era...
Powered by Rabbit 2.2.1 and COZMIXNG

Other slides