[R-SIG-Mac] ANSI escape weirdness on M1 (libedit issue?)

Prof Brian Ripley r|p|ey @end|ng |rom @t@t@@ox@@c@uk
Wed Nov 3 19:00:29 CET 2021


On 03/11/2021 12:21, Gábor Csárdi wrote:
> Anyone else noticed some weirdness with the arm build when the prompt
> has ANSI escape codes?
> 
> E.g. in a terminal run this
> options(prompt = "\033[1m> \033[0m")
> 
> and then at the new prompt type in some longer word and press CTRL+A.

Longer than what?

> The cursor does not go back to the beginning of the line, probably
> because the width of the prompt is not calculated correctly by the
> underlying system library.
> 
> readline is not listed at https://mac.r-project.org/libs-arm64/ while
> it is listed among the intel libs. Does that mean that R uses libedit
> on arm64? Is this an issue with libedit?

This is why we added extSoftversion(): please use it.

For my personal build of R-patched (which uses readline 8.1) this works 
as I expected.  With the CRAN build of 4.1.2 I do see some weirdness, e.g.

 > options(prompt = "\033[1mR> \033[0m")
R> abcdef

where after the Ctrl-A the cursor moves forwards a couple of characters. 
  (That 'R>' is bold will not show up in an email.

All on Monterey 12.0.1.

AFAIK the reason for not distributing readline with binary distributions 
of R is perceived licence restrictions.

-- 
Brian D. Ripley,                  ripley using stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford



More information about the R-SIG-Mac mailing list