wrkp {cursr}R Documentation

Echo Keypress to Screen

Description

Detect keypress and print it to the terminal screen, while invisibly returning the keypress. The user can specify which characters to ignore, and can also map keys to a list of functions. Any keypress mapped to a function will not be echoed to the screen.

Usage

wrkp(ignore = "escape", fn = list(), ...)

Arguments

ignore

vector of keypresses to ignore.

fn

list of functions, named by key, to be called when key is pressed.

...

parameters that are passed to style(), including the foreground color fg, background color bg, and attribute attr

Value

NULL

See Also

Other writing functions: wrat(), wrch(), wrkpl(), wr()

Examples

## Not run: 
wrkp(
 ignore="escape",
 fn = list(
   enter = function(){mv_row(1)},
   left = function(){mv(0, -1)},
   right = function(){mv(0, 1)},
   up = function(){mv(-1,0)},
   down = function(){mv(1,0)},
   space = function(){cat(" ")}
 )
)

## End(Not run)


[Package cursr version 0.1.0 Index]