Skip to content

Commit ed804a5

Browse files
committed
docs: clarify 'final group'
Fixes: #2369 Test-bot: skip
1 parent 97e9243 commit ed804a5

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

developer/language/guide/groups.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,26 +133,38 @@ future versions of the language.
133133

134134
## Empty final group
135135

136-
If the final group processed is a context and keystroke group (`using keys`),
137-
and there is no `nomatch` rule, and the keystroke is not matched in the group,
138-
the keystroke will be output to the screen, regardless of whether or not it was
139-
matched in earlier groups.
136+
There is a side-effect of keystroke processing, when the last group that is
137+
processed during a keystroke event has the following properties:
140138

141-
This can be used for example if you want to process a change at the end of a
142-
word which might be the last word in a line or in a text field, where the user
139+
1. it is a context and keystroke group (`using keys`), and
140+
2. is has no `nomatch` rule, and
141+
3. it has no rule matching the keystroke
142+
143+
In this situation, the keystroke will be emitted to the application, even if it
144+
was matched in earlier groups.
145+
146+
See [Control keys and control characters](control-keys) for further discussion.
147+
148+
### Example with Enter or Tab
149+
150+
This is can helpful, for example, if you want to process a change at the end of
151+
a word which might be the last word in a line or in a text field, where the user
143152
presses <kbd>Enter</kbd> or <kbd>Tab</kbd>:
144153

145154
```
155+
begin Unicode > use(main)
156+
146157
group(main) using keys
147158
148159
+ 's' > 'σ'
149160
'σ + [K_ENTER] > 'ς' use(final)
161+
'σ + [K_TAB] > 'ς' use(final)
150162
151163
group(final) using keys
152-
c Empty final group causes keystroke to be emitted
164+
c Empty group causes keystroke to be emitted
153165
```
154166

155-
See [Control keys and control characters](control-keys) for more details.
167+
Note: the name of the group is not significant.
156168

157169
## Statements and rules used with groups
158170

0 commit comments

Comments
 (0)