KC
Summary
Gets context
for an ongoing
keyboard operation relative to the caret's present position.
Syntax
KeymanWeb.KC(n, ln, Pelem);
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:
KeymanWeb.KO(3, Pelem, KeymanWeb.KC(2, 1, Pelem));
KeymanWeb.KO(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.