From b.rowlingson at lancaster.ac.uk  Thu Nov  7 10:13:18 2013
From: b.rowlingson at lancaster.ac.uk (Barry Rowlingson)
Date: Thu, 7 Nov 2013 09:13:18 +0000
Subject: [Rd] cat with backspace and newline characters
In-Reply-To: <3e624aa3dd724c3aa3d6221fdf0dacf5@EX-0-HT0.lancs.local>
References: <CAHavPHGe1A7R6RxD45exQnq7zJXWatiKQ8rR7SiFJBE2RGVQDQ@mail.gmail.com>
	<CADv2QyG6Nvn+YJ46Pz5PF7FqB9Q-LnEeLE4_EAgfVgBKo+EakA@mail.gmail.com>
	<CAHavPHH7VMYxBLjJsDO_2wwS-tC=gwbHiMfXVeP4fhXPZiJwNg@mail.gmail.com>
	<CAH7sKSN6a7ObU8g7xXf+fHq0cdMeKvsr7PSsorhNZ=DP3Pf8Ow@mail.gmail.com>
	<21112.61708.698124.149056@stat.math.ethz.ch>
	<8E2469B4-2A7B-44DD-896F-F409C39F4496@sciviews.org>
	<21113.8847.603856.486049@stat.math.ethz.ch>
	<A750360B-31A8-49EB-B21F-87EE4BA6E412@gmail.com>
	<CANROs4e=Do0ejPc7w=rOzG8zzNdhkmYWFJN=qU61JQRGnLWiPQ@mail.gmail.com>
	<CAHavPHHwsSq05zhDcCVMBo6kbvgBRwetCx45H19knmRU1xs-_Q@mail.gmail.com>
	<15FAF9D3-1BA6-48EA-8B98-1347B97256CD@r-project.org>
	<CAHavPHEOdVJQH_iv3WhxZm65uoJPh+Wn1=B1Vd+O7Fdt3aQnTw@mail.gmail.com>
	<3e624aa3dd724c3aa3d6221fdf0dacf5@EX-0-HT0.lancs.local>
Message-ID: <CANVKczNpi9p+c5zkZBj2vjSyVkUcb12XzTrj6+nfbesg84QNig@mail.gmail.com>

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



[Rd] cat with backspace and newline characters
Barry Rowlingson