# NOT RUN {
## We `dontrun` these examples as they involve pagers that should only be run
## in interactive mode
# }
# NOT RUN {
## Assuming system pager is `less` and terminal supports ANSI ESC sequences
## Equivalent to running `less -RFX`
diffChr(1:200, 180:300, pager=PagerSystemLess(flags="RFX"))
## System pager is not less, but it supports ANSI escape sequences
diffChr(1:200, 180:300, pager=PagerSystem(ansi=TRUE))
## Use a custom pager, in this case we make up a trivial one and configure it
## always page (`threshold=0L`)
page.fun <- function(x) cat(paste0("| ", readLines(x)), sep="\n")
page.conf <- PagerSystem(pager=page.fun, threshold=0L)
diffChr(1:200, 180:300, pager=page.conf, width=getOption("width") - 2)
## Set-up the custom pager as the default pager
options(diffobj.pager=page.conf)
diffChr(1:200, 180:300)
## A blocking pager (this is effectively very similar to what `PagerBrowser`
## does); need to block b/c otherwise temp file with diff could be deleted
## before the device has a chance to read it since `browseURL` is not
## blocking itself. On OS X we need to specify the extension so the correct
## program opens it (in this case `TextEdit`):
page.fun <- make_blocking(browseURL)
page.conf <- PagerSystem(pager=page.fun, file.ext="txt")
diffChr(1:200, 180:300, pager=page.conf)
# }
Run the code above in your browser using DataLab