[R] Command-line editing & history

Glenn Davis gdavis at gluonics.com
Sat Sep 29 23:36:22 CEST 2007



Prof Brian Ripley wrote:
> 
> 
>> So I guess my question changes to: Does anyone know if there are plans / 
>> is it possible to add GNU Readline functionality in the Windoze port?
> 
> No plans, especially as Rterm.exe already has getline with very similar 
> functionality.  But of course you are welcome to contribute your own 
> Windows console with readline functionality.  We look forwards to hearing 
> how you get on.
> 
> 


I'm contributing a patch (to recent trunk) that does what John McHenry asked
about,
(but not full readline functionality).
It's for Matlab-like 'smart-recall' in Windows RGui.exe.
The only file modified is gnuwin32/console.c.
There are changes to consolereads(), and a small new function.
The diff file is attached.

What it does:
Type a short string, and then the up-arrow key.  The most recent command
that
begins with that string is displayed.
Keep pressing up-arrow and the next matching command is displayed.
When there are no more matching commands, the up-arrow key has no effect.
Press the down-arrow key to cycle back again to the first matching command
(but not to the original short string, though this would be possible too).

If the a previous command is edited,
the entire new command becomes the new matching string.

Note:  I'm not sure about the function of CHARTRANS.
I assume it changes the current command.

Glenn Davis
http://www.nabble.com/file/p12959946/smart-recall.diff smart-recall.diff 

-- 
View this message in context: http://www.nabble.com/Command-line-editing---history-tf1215370.html#a12959946
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list