Posted by h3rald
Thu, 27 Mar 2008 12:30:00 GMT
I’ve been kindly asked by the lead developer of RubyInLine to change the name of my InLine project, due to potential confusion and conflicts.
This makes sense, and I’m ready to change the name of my project, although I’m not that good at choosing original and smart names, so well, any suggestion is more than welcome!
I was thinking of something like:
- RawLine
- EditLine
- RawInput
- RubyInput
- RubyLine
I personally think that RawLine is probably the best option, but please, if have any better idea just speak up!
P.S.: “RedLine” is taken, unfortunately, otherwise it would have been my first choice since the beginning.
Posted in Blog | Tags OpenSource, programming, RawLine, ruby | 3 comments | no trackbacks
Posted by h3rald
Mon, 10 Mar 2008 12:59:00 GMT
One of the many things I like about Ruby is its cross-platform nature: as a general rule, Ruby code runs on everything which supports Ruby, regardless of its architecture and platform (yes, there are quite a few exceptions, but let’s accept this generalization for now).
More specifically, I liked the fact that I could use the GNU Readline library with Ruby seamlessly on both Windows and Linux.
Readline offers quite a lot of features which are useful for those people like me who enjoy creating command-line scripts, in a nutshell, it provides:
- File/Word completion
- History support
- Custom key bindings which can be modified via .inputrc
- Emacs and Vi edit modes
Basically it makes your command-line interface fast and powerful, and that’s not an overstatement. Ruby’s own IRB can be enhanced by enabling readline and completion, and it works great—at least on *nix systems.
For some weird reason, some people had problems with Readline on Windows: in particular, things get nasty when you start editing long lines. Text gets garbled, the cursor goes up one or two lines and doesn’t come back, and other similar leprechaun’s tricks, which are not that funny after a while.
Apparently there’s no alternative to Readline in the Ruby world. If you wan’t tab completion that’s it, you’re stuck. Would it be difficult to implement some of Readline functionality natively in Ruby? Maybe, but the problem is that for some reason the Ruby Standard Library doesn’t have low level methods to operate on keystrokes…
…but luckily, the HighLine gem does! James Edward Gray II keeps pointing out here and here that HighLine’s own get_character method does just that: it returns the corresponding character code(s) right when a key is pressed, unlike IO#gets() which waits for the user to press ENTER.
Believe it or not, that tiny method can do wonders…
Read more...
Posted in Blog | Tags OpenSource, programming, RawLine, ruby | 9 comments | no trackbacks