Comments on: Minimal line editing for OSX, Linux, BSD

Carl Sassenrath, CTO
REBOL Technologies
23-Jun-2009 3:50 GMT

Article #0214
Main page || Index || Prior Article [0213] || Next Article [0215] || 4 Comments || Send feedback

It's about time we consider some kind of minimal "readline" interface for editing R3 input on the non-windows boxes.

The perfect solution would be a page or so of C code that handles the most common editing keys (arrow keys mainly), and would not require any other libs. Unlikely? It's difficult to say. Seems like most systems are pretty standard on the term types these days.

The reason we need to keep it pure and simple is because every OS has a slightly different lib for doing it. Dealing with those libs gets very time consuming.

So, nothing fancy.

Update - 25-June-2009:

I ended up writing a readline for R3, from scratch. Didn't want to, but we really needed something to make the console usable in Unix-land.

My goal was to write readline in two pages of C, but it's ended up at about five. (That's certainly better than the 400 KB BSDed readline version I was thinking about downloading.)

Of course, problem is, I don't have a lot of time for this feature. "It's not on my list." So, currently, I've had to punt, and make it ASCII. Yes, I know, we need UTF-8 editing too. I think it's possible to extend the code with a few lines here and there. We shouldn't need to decode the UTF-8, simply recognize the code length per char, so we can do the right thing on arrow moves and backspace, etc.



24-Jun-2009 9:17:51
Until then, rlwrap is a great nifty tool; I don't use R3 without it.
Carl Sassenrath
24-Jun-2009 13:12:55
Andreas: good suggestion (rlwrap).

Well, I spent some time late last night thinking about the R3 requirements for the R3 stdio console, and it needs to work precisely how we require for REBOL. For example, not just line edit and history recall, but also features like the INPUT function, including the /hide mode.

My conclusion was it makes the most sense to begin with the R2 console handler, which works fairly well, and rework it for R3. That task should take only a day, and will make R3 much more usable over all Unix-like systems.

Carl Sassenrath
25-Jun-2009 20:12:13
Added an update to the main article above.
1-Jul-2009 6:56:07

Post a Comment:

You can post a comment here. Keep it on-topic.


Blog id:



 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 27-May-2024 - Edit - Copyright REBOL Technologies -