[R] width of terminal resize to current dimensions on linux Gnome terminal
ivo welch
ivo.welch at anderson.ucla.edu
Wed Jan 30 02:13:19 CET 2013
I just looked at the sample initialization script in the R docs. it
suggests the first two lines of
cols <- Sys.getenv("COLUMNS")
if(nzchar(cols)) options(width = as.integer(cols))
print(cols)
I run R 2.15.2 on a linux Gnome terminal 3.6.0 now. alas, this
snippet always prints "" (I replaced my .Rprofile to contain this
snippet only). in constrat, Sys.getenv("COLUMNS") after I see the ">"
prompt works fine.
on stackoverflow, there was an even nicer solution that suggested
dynamic window resizing would be possible:
.adjustWidth <- function(...){
try( options(width=Sys.getenv("COLUMNS")), silent = TRUE)
cat("[Reset Window Width]\n")
TRUE
}
.adjustWidthCallBack <- addTaskCallback(.adjustWidth)
alas, this does not seem to be called by a linux window resize, but by
every command now. is there a way to add a TaskCallback only when a
user resizes the window?
help appreciated...
/iaw
----
Ivo Welch (ivo.welch at gmail.com)
More information about the R-help
mailing list