[R] Smart detection of wrap width?

Peter Crowther peter.crowther at melandra.com
Sat Apr 18 22:41:01 CEST 2015


On Apr 17, 2015 7:37 PM, "Paul Domaskis" <paul.domaskis at gmail.com> wrote:
> I don't suppose there is a way to have it
> automatically invoked when the window size/positition changes?

Possibly, though it would take a little building.  If you were to
launch R directly when you start the xterm (loosely xterm R rather
than the default) then R would receive a SIGWINCH signal whenever the
xterm window size changes (xterm automatically sends this to its child
process).  R doesn't directly enable handling of the signal, but
there's nothing to stop you loading a dynamic library with a little C
code that set up a handler for SIGWINCH and, when it got one, ran the
equivalent of the stty command to get the new width.  The thing I've
not been able to figure out is how the C code would ever then hand
that to R asynchronously.  Anyone?

Cheers,

- Peter



More information about the R-help mailing list