[R] arrow keys in R

Richard O'Keefe r@oknz @end|ng |rom gm@||@com
Sat Feb 26 22:44:14 CET 2022


You do not say anything about the operating system you are
using, about whether it was built with "readline" support
or not, whether you are calling R directly or through a
pseudo-tty or remotely through ssh or PuTty.

(1) ^[[A is simply an echo of the ANSI escape sequence for
the move-left terminal function.  This is exactly what you
would expect to see from a program that doesn't understand
escape sequences.
(2) You can tell whether R was built with "readline" support
by entering
> extSoftVersion()["readline"]
"7.0" is the answer I get.
(3) R-with-readline uses the "move left" terminal function
to MOVE LEFT within the line you
 are entering (and the "move
right" terminal function to move right, strange as it may seem).
It does not use the left arrow for completion.
That's the job of "tab".
(4) If I type "li<COMPLETE>" R (readline) beeps at me because
it does not know what character comes next.  If I type
"<COMPLETE>" again, it shows me a list of possibilities.
There are 17 of them.  If I type "lib<COMPLETE>" I get another
beep, and typing "<COMPLETE>" again shows me a list of 4
possibilities.  Typing "libr<COMPLETE>" gives me "library"
and *another* beep because there are still 3 possibilities.
(5) Once again, the <COMPLETE> key is Tab.



On Sun, 27 Feb 2022 at 04:51, Bogdan Tanasa <tanasa using gmail.com> wrote:

> In R, I do press the arrow keys, and 2 things happen :
>
> On one hand, the symbols ^[[A^[[A^[[A appear;
>
> On the other hand, shall I start typing a command, such as "library", I
> begin by typing the first 2 letters "li", click "left arrow", and the
> result is "li "(i.e. lots of spaces) instead of having the command
> "library" written on the screen.
>
> Is there any way to fix it please ? Thanks,
>
> Bogdan
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list