Ruby

Summarized using AI

Graphical Terminal User Interface of Ruby 3.1

ITOYANAGI Sakura • September 09, 2021 • online

In this presentation titled "Graphical Terminal User Interface of Ruby 3.1," ITOYANAGI Sakura discusses the new features in the Interactive Ruby (IRB) that accompany Ruby version 3.1, particularly focusing on the dialog window feature implemented through Reline. The presentation is part of the RubyKaigi Takeout 2021 event, where Sakura shares insights regarding their experiences in developing the new features while balancing personal tasks such as climbing and hiking. Here are the key points covered in the video:

  • Introduction to Reline and IRB: The IRB (Interactive Ruby) has seen several improvements aimed at enhancing user experience through better functionality. The speaker emphasizes that Reline, a terminal control software they built from scratch, serves as the foundation for these advancements.

  • Dialog Window Feature: Sakura introduces the new dialog window feature in IRB, likening it to interfaces found in Integrated Development Environments (IDEs). This feature allows users to see context-related information and options displayed by the cursor in a user-friendly manner.

  • User Interactivity: The dialog window can be navigated with keystrokes, and it includes options for defining its dimensions and enabling scrollbars. Users can benefit from auto-completion capabilities without needing additional complex setups.

  • Document Viewing Improvements: A significant enhancement in the new IRB is the ability to display documentation along with autocomplete options. The speaker notes that accessibility has been improved, making it easier for users to access relevant documentation without needing additional instructions.

  • Community Support and Contributions: ITOYANAGI expresses a desire for collaboration in maintaining Reline and mentions that contributions would be valued through GitHub Sponsors. They highlight the need for individuals who have a strong commitment to the Ruby ecosystem.

Conclusions

These improvements reflect ongoing efforts to enhance the Ruby programming experience, combating historical issues regarding the accessibility of documentation and tools for developers. The speaker reinforces the message that the best user interfaces are intuitive and require minimal explanation, showcasing the advancements made with IRB 3.1 in line with this principle.

Graphical Terminal User Interface of Ruby 3.1
ITOYANAGI Sakura • September 09, 2021 • online

The IRB shipped with Ruby 3.1 provides a dialog window feature on the terminal to achieve autocomplete. This is implemented as a new feature in Reline, which displays a dialog in an interactive user input interface at any time you want.

In this article, I will show you how to utilize this dialog display feature of Reline, with IRB and the Ruby debugger which is a new feature in Ruby 3.1.

RubyKaigi Takeout 2021: https://rubykaigi.org/2021-takeout/presentations/aycabta.html

RubyKaigi 2021 Takeout

00:00:11.200 Hello everyone, my name is ItoYANAGI. I'm a climber, and in particular, I do a lot of hiking in the mountains. It is said that the best way to enjoy the mountains is to be in a sauna.
00:00:17.920 So, I went through the wilderness, climbed waterfalls, sometimes procured food locally, slept by the fire, and headed for the headquarters.
00:00:21.199 I was supposed to give a technical presentation on the riverside, as I always do in my online presentations, but I couldn't make it at all. So, I just mashed together some random footage from some mountains and overlaid a technical explanation on top of it.
00:00:41.680 First of all, let me explain what the schedule was like this time. When I was accepted to RubyKaigi, I hadn't implemented any of the accepted features. This is a rough technique called Kaiki-driven development that Ruby committers often use to make progress by taking advantage of the fact they will have to implement the content to present it.
00:00:55.600 The deadline for submitting videos for this year's English presentation was August 31st. I started working on it on August 17th. It was all too late. Anyway, now it’s not anywhere or anything, but let me blatantly introduce myself. I'm a Ruby committer, a member of RubyKaigi, and a member of Asakusa Ruby.
00:02:26.800 In recent years, Ruby's IRB has undergone significant improvements. The multi-line editing feature is a clear example of this. The implementation of the new feature is based on Reline, a software I wrote from scratch. It achieves the ability to handle all the terminal control independently.
00:02:55.760 According to Naru Cesan, a Ruby committer, there are three major components in programming: operating systems, programming languages, terminals, and text editors. Reline implements terminal and text editing out of these components.
00:03:06.400 It requires an immense amount of work just to add small new features. I've already added about 150 comments, yet I just started working on it on August 17th.
00:03:30.720 So what is the new feature that I've implemented in Reline? It is a dialog window. You may be familiar with this feature from the past if you are using an IDE.
00:03:49.440 I'll show you a demonstration of the implementation in action here. Since IRB is a text editor for typing code, the dialog window is displayed in relation to the cursor position, just like in an IDE. You can also specify a relative distance to display it a little further away.
00:04:40.800 It is also possible to trap the specified keystroke while a dialog window is displayed. The specified key does not enter into the normal keystroke processing of Reline but can be handled by the dialog window callback.
00:05:11.840 It's possible to navigate through the dialog window using keystrokes. The width and height of the dialog window will be determined automatically, but you can also specify a maximum size. The width will be shortened by cutting down the amount of overflowing content while the height will scroll. A scrollbar can be displayed if necessary.
00:08:23.120 You can also use an existing compilation engine to achieve auto compilation without any special implementation on your own. I'll demonstrate this with just this code.
00:09:10.560 Let's go.
00:10:02.839 Now then, let's take a look at a real-world example from IRB. Nowadays, IRB has compilation turned on by default, so just go through to Relying on the compilation, and the auto-completion will be displayed.
00:10:41.040 Now you can use the raised console without worrying about adding many classes and methods to your business card.
00:11:25.120 Here's the thing: everything I've shown you so far is just preparation. The already released stable version of IRB does not yet have the features introduced today, but it has a document viewing feature. After the usual topic compilation, pressing the table key again without a perfect match will display the document.
00:12:21.360 However, I found it difficult to notice this user interface in its current form; it felt like just a hidden command.
00:12:53.279 In the new IRB, we have implemented a document display along with autocomplete. The best user interface is one that requires no explanation. Accessing a document no longer requires an explanation.
00:13:40.079 However, there is one explanation that I can't help but display: press 'Alt+D' to read the full document. A key trap has been set to display the full document, and you will exit the document view and return to the original screen when you press 'Q'.
00:15:53.120 All the major improvements to IRB over the past few years have been steadfast in combating the long-standing trend of not installing documentation on local machines. I need someone to help me maintain Relying. Relying and our documentation are two of the largest standard libraries written in Ruby, and there should be almost no one in the world who can maintain them.
00:17:25.120 This depends less on being competent and more on demonstrating an unusual obsession with a specialized area. Working together might only make us unhappy if someone comes along but if someone really wants to work on it, I'd appreciate it.
00:18:37.440 I think there are probably a few like-minded people in the world.
00:20:14.240 Alternatively, I look forward to your support via GitHub Sponsors.
Explore all talks recorded at RubyKaigi 2021 Takeout
+32