wrkpl {cursr}R Documentation

Echo Keypress to Screen in a Loop

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

wrkpl(escape = c("escape"), ignore = NA_character_, fn = list(), ...)

Arguments

escape

vector of keypresses to escape the loop.

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(), wrkp(), wr()

Examples

## Not run: 
wrkpl(
  escape = "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]