Comments on: Minimal line editing for OSX, Linux, BSD
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.
Until then, rlwrap is a great nifty tool; I don't use R3 without it.|
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.
Added an update to the main article above.|
Post a Comment:
You can post a comment here. Keep it on-topic.