Hi, when mixing newline and backspace characters I get the following output (see below). In the second call, the backspace character is simply not applied. Is this normal behaviour? Thank you.> cat("abc\b")ab> cat("abc\b\n") abc>[[alternative HTML version deleted]]
I don't know what the normal behaviour is. I was expecting the remaining of the line to be wiped out, but you must be right: the character 'c' is already printed, the cursor moves back one position and go to the next line, leaving the 'c' in place. But what about this one:> cat("abc\b\b\b") > cHere, I end up with the cursor being on the 'c', i.e. if I type something it erase the 'c'. It is strange that the 'c' appears _after_ the console prompt, isn't it? Renaud On 1 November 2013 13:41, Sean O'Riordain <seanpor@acm.org> wrote:> Hi Renaud, > > Are you sure it's not applied? is \b a backspace i.e. just move the > cursor back one space, or is it a delete the character to the left of > the cursor? > > Kind regards, > Sean > > > On 1 November 2013 11:06, Renaud Gaujoux <renaud@mancala.cbio.uct.ac.za> > wrote: > > Hi, > > > > when mixing newline and backspace characters I get the following output > > (see below). In the second call, the backspace character is simply not > > applied. Is this normal behaviour? > > Thank you. > > > >> cat("abc\b") > > ab> cat("abc\b\n") > > abc > >> > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-devel@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel > >[[alternative HTML version deleted]]
Hello, Can't reproduce it, there must be something with your console. I get > cat("abc\b") ab> cat("abc\b\n") ab > Hope this helps, Rui Barradas Em 01-11-2013 11:06, Renaud Gaujoux escreveu:> Hi, > > when mixing newline and backspace characters I get the following output > (see below). In the second call, the backspace character is simply not > applied. Is this normal behaviour? > Thank you. > >> cat("abc\b") > ab> cat("abc\b\n") > abc >> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
Maybe it's a Linux problem:> cat("abc\b")ab> cat("abc\b\n") abc> sessionInfo()R version 3.0.2 (2013-09-25) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base> > Sys.info()sysname "Linux" release "3.11.0-12-generic" version "#19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013" nodename "XXXXX" machine "x86_64" login "XXXXX" user "XXXXX" effective_user "XXXXX">On 1 November 2013 19:54, Dennis Murphy <djmuser@gmail.com> wrote:> I can't reproduce the error, either: > > > cat("abc\b") > ab> cat("abc\b\n") > ab > > > > sessionInfo() > R version 3.0.2 (2013-09-25) > Platform: x86_64-w64-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United States.1252 > [2] LC_CTYPE=English_United States.1252 > [3] LC_MONETARY=English_United States.1252 > [4] LC_NUMERIC=C > [5] LC_TIME=English_United States.1252 > > <package info snipped for brevity> > > Dennis >[[alternative HTML version deleted]]
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
Over the years, this has been useful to me (not just in R) for many nonlinear optimization tasks. The alternatives often clutter the screen.> On 13-11-06 06:00 AM, r-devel-request at r-project.org wrote:> People do sometimes use this pattern for displaying progress (e.g. iteration counts). >> >>As this looks like a "terminal" matter, the first level solution may be to take a couple of examples and prepare a table of what happens on the most used platforms, including in things like RStudio and ESS. Might be a good issue for Rwiki, as I'm sure few of us have all the choices. I can generally live with warning users when the iteration display may display oddly. Perhaps others have more stringent requirements, but if documentation is enough, we can avoid fixing something that is more or less outside R and may be unnecessary work. And documented examples can also show us if things are changing. JN