[Rd] Bracketed paste issues on Linux
Tomas Kalibera
tom@@@k@||ber@ @end|ng |rom gm@||@com
Sun Jun 13 10:00:27 CEST 2021
Thanks for the report. Could you please also post output from
extSoftVersion() ?
What happens if you paste just a smaller part of the code before the
long line? Is the output still corrupted? If so, is it corrupted the
same way, at the same places?
(It seems to be working on my Ubuntu 20.04, readline 8.0, R-devel)
Thanks
Tomas
On 6/12/21 3:44 PM, Cesko Voeten wrote:
> I am on an up-to-date Arch Linux system, using the GNOME desktop environment. By default, this turns on bracketed paste in terminal emulators; for those not familiar with this concept: it makes it so that if you paste in multiple lines of code, they are received in a single chunk. This works just fine with R, up to a certain amount of text: for chunks past a certain length, some amount of text in the middle of the chunk goes missing. For example, if I print the source of mgcv::gam into my R session and then attempt to copy and paste it back in, what I end up with is:
>
> <snip 53 perfectly good lines>
> pmf$formula <- gp$pf
> pmf <- eval(pmf, parent.frame())
> } objectvironment(attr(object$pred.formula, "full")) <- .GlobalEnv<- environment(object$terms) <- environment(object$pterms) <- .GlobalEnv
>
> So:
> - the first 55 lines in this example arrive perfectly fine
> - then a bunch go completely missing
> - then various parts of the last few lines are jumbled together into one line
>
> For reference on the third point, the actual last 10 lines of my version of mgcv::gam are:
> if (is.null(object$deviance))
> object$deviance <- sum(residuals(object, "deviance")^2)
> names(object$gcv.ubre) <- method
> environment(object$formula) <- environment(object$pred.formula) <- environment(object$terms) <- environment(object$pterms) <- .GlobalEnv
> if (!is.null(object$model))
> environment(attr(object$model, "terms")) <- .GlobalEnv
> if (!is.null(attr(object$pred.formula, "full")))
> environment(attr(object$pred.formula, "full")) <- .GlobalEnv
> object
> }
>
> parts of which can be recognized in the last line of what was pasted.
> Naturally, the pasted function is not parsed properly: if I press return I get the expected "+" signaling that the REPL is expecting more input. So it is not merely a visual issue.
>
> I can reproduce this both in GNOME Terminal and in xterm, so it is not a bug specific to my terminal emulator. In addition, pasting the exact same code into either vim or nano running within the same terminal works fine. So I believe that this may be a bug in R itself. It's easy to work around by disabling bracketed paste in the terminal, but it would be great if this could actually be made to work, especially given that bracketed paste is the default on my desktop environment.
>
> If given an account, I would be happy to file this as a bug; let me know if that is desired. In the meantime, have others run into this and perhaps identified the root cause and/or a different workaround?
>
> Thanks,
> Cesko
>
> sessionInfo():
>
> R version 4.1.0 (2021-05-18)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Arch Linux
>
> Matrix products: default
> BLAS/LAPACK: /opt/intel/mkl/lib/intel64/libmkl_gf_lp64.so
>
> locale:
> [1] LC_CTYPE=nl_NL.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=nl_NL.UTF-8 LC_COLLATE=nl_NL.UTF-8
> [5] LC_MONETARY=nl_NL.UTF-8 LC_MESSAGES=nl_NL.UTF-8
> [7] LC_PAPER=nl_NL.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=nl_NL.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> loaded via a namespace (and not attached):
> [1] compiler_4.1.0 Matrix_1.3-4 mgcv_1.8-36 splines_4.1.0
> [5] nlme_3.1-152 grid_4.1.0 lattice_0.20-44
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list