[Rd] cat with backspace and newline characters

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Nov 7 10:13:18 CET 2013


On Thu, Nov 7, 2013 at 8:28 AM, Jari Oksanen <jari.oksanen at oulu.fi> wrote:
>
> On 07/11/2013, at 09:35 AM, Renaud Gaujoux wrote:
>
>> I agree that the handling of \b is not that strange, once one agrees
>> on what \b actually means, i.e. "go back one character" and not
>> "delete previous character".

It means, to paraphrase Humpty Dumpty from Alice in Wonderland,
whatever the terminal chooses it to mean. If you want to do something
meaningful and consistent across different terminals, you use termcap
or terminfo:

 http://en.wikipedia.org/wiki/Termcap
 http://en.wikipedia.org/wiki/Terminfo

or other abstractions probably built on that (eg 'ncurses').

> As a user DEC LA120 terminal I expect the following:
>
>> cat("a\b^\n")
> â
>>
>
> Everything else feels like a bug.

 Oh noes! I don't have a terminfo entry for my DEC LA120!

 I don't know what flavour of 'terminal' RStudio, the Windows GUI or
emacs-ess behave as and whether there's terminfo entries for them....

 Do any R packages link with termcap to do controlled screen output? Hmmmm....

Barry



More information about the R-devel mailing list