RubyKaigi 2019

Summarized using AI

Terminal Editors For Ruby Core Toolchain

ITOYANAGI Sakura • April 18, 2019 • Fukuoka, Japan

In this presentation titled "Terminal Editors For Ruby Core Toolchain" delivered at RubyKaigi 2019, Sakura Itoyanagi introduces his development of "Reline," a compatibility library designed to enhance terminal usability for Ruby programmers. The speaker outlines the challenges faced with the new Gridline tool and discusses how Reline provides a readline-compatible environment written in pure Ruby, addressing installation issues that frustrate beginners. Key highlights of the talk include:

  • Background Information: Introduced himself as a member of the Ruby core team and provided personal anecdotes related to his background and interests, including a history as a ramen chef and his passion for climbing.
  • Motivation for Reline: Acknowledged personal challenges due to a wrist injury that affected his programming work, pushing him to focus on developing more effective tools for terminal interaction.
  • Technical Context: Explained issues associated with terminal navigation and input in Ruby without proper readline libraries, emphasizing the need for a more user-friendly solution.
  • Reline Features: Detailed the functionalities of Reline, particularly its support for multiline editing and Windows compatibility via Win32 API, alongside managing ANSI escape codes for improved terminal output.
  • Focus Areas: Discussed character representation challenges in terminals and emphasized the significance of proper escape sequence management for enhanced usability.
  • Development of Reidline: Highlighted his contributions to Reidline, another multiline editor designed for IRB, discussing the improvements made to address earlier technical problems.
  • Demonstration: Provided a live demonstration showcasing Reline in action on Ruby 2.7, illustrating features like auto-completion and multi-line command execution, drawing parallels to similar functionalities found in JavaScript consoles.
  • Conclusion: Encouraged feedback and questions about Reline and reiterated his commitment to continuous improvement of terminal editing systems.

In conclusion, Itoyanagi underscores the importance of enhancing Ruby's terminal interface for both beginners and seasoned users, aiming to create a more cohesive and productive coding environment.

Terminal Editors For Ruby Core Toolchain
ITOYANAGI Sakura • April 18, 2019 • Fukuoka, Japan

I implemented "Reline" that is a compatibility library with "readline" stdlib by pure Ruby and works correctly without GNU Readline and works on Windows too.

"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.

These are highlights of Ruby 2.7. I'll talk about the technical problems of these and show a demo on Ruby 2.7.

RubyKaigi 2019 https://rubykaigi.org/2019/presentations/aycabta.html#apr18

RubyKaigi 2019

00:00:00.120 Hello everyone, welcome to Kokura, Japan.
00:00:13.860 My GitHub account is LycAppa. I am a documentation maintainer and a member of the Ruby core team.
00:00:19.619 Yesterday, we discussed the new features in Ruby 2.7. It was an intense session, and I am quite tired.
00:00:34.190 This process took place just after the keynote session. Yes, I was at home yesterday, but today I am here.
00:00:45.329 The green area you see is Kyushu on the map of Japan. I was born in Nagasaki, which is situated in the same cultural area as Kokura.
00:01:10.040 For example, both areas are famous for their tonkotsu ramen. About 20 years ago, I worked in a tonkotsu ramen shop.
00:01:26.460 I was a chef back then, and I remember Mont Blanc ice cream, which is a famous dessert in Kyushu.
00:01:35.880 This ice cream is loved by people, as it is covered in black chocolate with crunchy chips, providing a perfect balance of flavor.
00:01:48.090 Almost every convenience store in Kyushu sells Mont Blanc ice cream.
00:01:53.909 It is a product of Takeshita Sake, which has many other ice cream products, including Miracle Miracle, made with rich milk.
00:02:06.970 These ice creams are very tasty, so if you get the chance, please try them.
00:02:14.650 I'm a member of a society where we hold Ruby events in Tokyo every Tuesday. I attend all six Ruby events each week and mini speakers talk.
00:02:24.400 I'm currently working at Space Pilots and Pirates as an Elastic Search specialist, which is quite a complex field.
00:02:38.920 I engage in climbing as a hobby and often climb when attending Ruby conferences.
00:02:46.870 For instance, I climbed in Malaysia and Taiwan.
00:02:59.540 However, I recently injured my wrist during training and couldn't climb before this RubyKaigi.
00:03:06.230 Last weekend, I went camping and had a great experience.
00:03:13.700 I am using a prosthetic finger for climbing, which is very helpful.
00:03:22.240 Despite my injury, I am recovering and able to climb again.
00:03:32.920 This type of wrist injury can be quite challenging and impacts my daily activities.
00:03:47.830 I'm still working through the recovery process.
00:04:00.490 Moving to typing is still difficult for me, as it creates discomfort.
00:04:13.170 As a programmer, this injury affects how I interact with the keyboard.
00:04:21.700 Therefore, I had to consider what tools would work best for me.
00:04:29.920 Today, I will discuss terminal editors for the Ruby core toolchain, including my tips for overcoming my injury.
00:04:43.310 One major issue is the installation of new Gridline; it does not include readline.
00:04:54.180 New Gridline is a line editor software that is supposed to be very convenient.
00:05:06.210 If Ruby is built without installing a library that includes readline, it results in a frustrating experience for beginners.
00:05:13.690 Only basic input functions are available, leading to challenges in terminal navigation.
00:05:25.160 This situation can be quite depressing for new users.
00:05:34.900 I spend a lot of time writing Ruby code, but the syntax can be quite complex and is often not intuitive for those new to programming.
00:05:45.750 Ruby syntax is designed for users, but it can be difficult to navigate for beginners.
00:05:54.820 I want to help users like me who need a more effective way to rebuild the Ruby environment.
00:06:06.440 That's why I developed Reline, a readline-compatible library written in pure Ruby.
00:06:19.360 Initially, I planned to explain terminal technologies in this session.
00:06:30.760 However, I decided to focus on more foundational aspects of text editors.
00:06:41.190 Tomorrow, there will be a session discussing terminal techniques.
00:06:49.560 I developed Reline which is also a readline-compatible library aimed at providing more efficient terminal interactions.
00:07:01.090 My goal is to quickly finalize development to deliver many features.
00:07:08.250 The next priority is supporting Windows through Win32 API.
00:07:19.150 This approach will ensure better compatibility for Windows command prompt users.
00:07:28.440 Additionally, I will be exploring how to effectively handle ANSI escape codes across different command line interfaces.
00:07:39.040 ANSI escape codes allow for control over cursor location, color, and other terminal functionalities.
00:07:55.580 Many years ago, there were numerous terminal types with no standardization; ANSI escape codes now serve as a unified standard.
00:08:07.500 For instance, I can show you Ruby's output colors using specific ANSI codes.
00:08:19.950 This allows for color-coded text outputs, enhancing visibility and usability.
00:08:36.470 Moreover, some ANSI escape sequences can perform specific formatting tasks.
00:08:44.780 It's essential to be aware that certain sequences are still limited for specific applications.
00:08:56.760 For example, in console output, lengthy lines may lead to delays in display if not handled properly.
00:09:12.310 So terminal software needs to efficiently manage how text is presented.
00:09:21.900 Let’s move on to Win32 API for Windows. This API enables calling functions from dynamic libraries.
00:09:42.630 I find it crucial to use these native functions for achieving compatibility with Windows terminals.
00:09:54.650 Utilizing Win32 API helps to manage console output and operations like cursor positioning.
00:10:07.250 It was a challenge, but the process was rewarding.
00:10:16.410 I often find myself programming in various locations, from my desk to public transport.
00:10:36.230 No matter where I am, I prioritize being productive.
00:10:47.870 Despite a few issues with Unicode character representation, I remain focused on delivering solid improvements.
00:11:02.340 During conferences, I noticed the complexity of character representation can often confuse discussions.
00:11:17.360 Some Unicode characters change depending on the specific terminal settings.
00:11:30.150 This means you may encounter unexpected behaviors across different systems.
00:11:37.750 Let me share an example: I often showcase an unpredictable character that varies by terminal type.
00:11:47.400 This duality showcases how terminal settings alter character representation.
00:11:54.690 Such discrepancies can result in ambiguity in character alignment and spacing.
00:12:04.980 For instance, terminal emulations can differ based on software and their configurations.
00:12:13.560 It's important to maintain consistency when organizing cursor positions and outputs.
00:12:23.230 The integrity of Unicode handling is a core part of my work.
00:12:32.050 Returning to the subject of escape sequences, they need to be managed correctly for accurate rendering.
00:12:43.380 Next, understanding the Win32 API's role in terminal management is crucial.
00:12:53.270 The API offers efficient management for console inputs and outputs.
00:13:06.720 My experiences in terminal programming have led to some unique design choices.
00:13:21.700 For example, I utilize specific API calls for streamlined operations.
00:13:32.900 The API design incorporates fast response times for command operations.
00:13:42.130 These functions make handling console operations more efficient.
00:13:57.250 Despite the complexities of managing a diverse coding environment, I feel accomplished.
00:14:09.340 I can pivot on my projects, tackling unexpected challenges as they arise.
00:14:21.660 Let’s express outputs for clarity using ANSI standards.
00:14:32.820 For example, we use colors to separate different types of outputs distinctly.
00:14:42.420 Next, I will show how we can implement progress indicator sequences for terminal commands.
00:14:54.760 Using the proper escape sequences allows us to create dynamic displays during processing.
00:15:09.180 While testing realign features, I demonstrated some essential code samples.
00:15:22.410 These tests helped illuminate the importance of efficiency in handling character trees.
00:15:34.870 We have to remain agile in implementing features while keeping track of performance.
00:15:49.920 I continually aim for enhanced usability and clarity in my terminal editor.
00:16:04.280 This is particularly critical when considering a multi-user environment.
00:16:16.780 We want to offer each user an excellent, consistent experience.
00:16:29.140 There’s also a history of discussing using these editors for multilanguage support.
00:16:42.440 Now, I’ll transition to describe Redline, a markdown editor which streamlines Ruby development.
00:16:56.030 Redline is designed for new IRB by Keiji-san, who is considered Ruby's grandfather.
00:17:09.470 It functions like a multiline editor, similar to a JavaScript console found in browsers.
00:17:23.780 Despite facing many technical challenges, I have worked diligently to resolve many of them.
00:17:36.540 I aim to enhance the usability of Redline and improve its features.
00:17:50.980 Just yesterday, I finalized numerous updates, especially regarding the handling of neck and shoulder strain.
00:18:04.320 This is particularly important for those who spend long hours coding.
00:18:14.180 Moving on, Ruby is a fantastic language for developing a text editor.
00:18:27.180 Three editors play an essential part in my development process: Sugar, Mine, and Redline.
00:18:41.350 I actively maintain these editors and continually seek to enhance their performance.
00:18:53.620 For instance, I added a new feature to display documents after compilation.
00:19:07.780 Now, let’s move to the demonstration of the various features we discussed.
00:19:21.720 This is the demo of the IRB version of Ruby.
00:19:31.470 This version is 2.7.0. As we begin, let’s try a simple command.
00:19:41.880 For example, I can press tab to auto-complete names in our current scope.
00:19:51.320 This functionality enhances the interactive coding experience.
00:20:00.000 When I press the tab key again, it expands the suggestions further.
00:20:12.160 Thank you for your attention.
00:20:20.850 This feels amusing for me!
00:20:32.120 Yesterday, I pressed the documentation key hundreds of times.
00:20:39.060 It was hectic but rewarding.
00:20:48.200 Now, I’ll demonstrate how to implement a multi-line editor.
00:20:57.560 By defining functions like 'def' in Ruby, we can build multi-line structures.
00:21:06.680 For example, I can assign variables and execute blocks.
00:21:14.080 This closely resembles features in JavaScript.
00:21:20.200 Mistakes are inevitable, but that’s all part of the learning process.
00:21:30.500 Lastly, interactive Ruby’s version can evaluate all source code.
00:21:41.360 It functions similarly to defining methods in conventional programming.
00:21:52.560 Continuing to develop this editing system is a rewarding challenge.
00:22:06.680 As my journey continues, I am committed to enhancing usability as well.
00:22:18.820 We anticipate the new version of Ruby to include impressive updates.
00:22:32.640 I always seek to improve and adapt.
00:22:42.720 If you have any questions following this session, feel free to come to me.
00:22:53.820 Thank you!
Explore all talks recorded at RubyKaigi 2019
+69