Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 17.0 (current version)Version 16.0Version 15.0Version 14.0Version 13.0Version 12.0Version 11.0Version 10.0

On this page

context (KC) (Deprecated)

Summary

(Deprecated) Gets context for an ongoing keyboard operation relative to the caret's present position.

Syntax

keyman.interface.context(n, ln, Pelem);

or

KeymanWeb.KC(n, ln, Pelem); // Shorthand

Parameters

n
Type: number
Relative position of the caret for the context retrieval operation.
ln
Type: number
Number of characters of text context to retrieve.
Pelem
Type: Element
The element being operated upon.

Return Value

string
The requested context text.

Description

For an example from Developer 'rules', a keyboard might implement the following rule

"abc" + "d" > context(2) "D"

by first checking that the initial context ("abc") matches and then using the following to fulfill the rule:

keyman.interface.output(3, Pelem, keyman.interface.context(2, 1, Pelem));
keyman.interface.output(0, Pelem, "D");

This operates by first replacing the original context "abc" with the requested subset of context(2), then outputting the character ("D") corresponding to the new keystroke.

See also

keyman.interface.contextMatch(), keyman.interface.output()