cursorless
cursorless copied to clipboard
Filter / forgiving modifiers
- [x] Error when can't expand (
"funk") (default behaviour) - [ ] Keep only inputs which don't error when applying modifier, but return the input unchanged (
"can funk")- eg is it weakly contained by visible characters? (
"can char")
- eg is it weakly contained by visible characters? (
- [ ] Drop target when can't expand; expand those that can (
"only funk") - [ ] Passthrough unmodified those that can't expand; expand those that can (
"soft funk")
Implementation
We can implement this with a new compositional modifier:
interface ErrorSuppressorModifier {
type: "errorSuppressor";
modifier: Modifier;
onSuccess: "useOriginal" | "useModified";
onError: "useOriginal" | "drop";
}
The modifier stage would just apply modifier, surrounded by a try block. On success it would either use the original or modified depending on onSuccess. On error it would either use original or return [] depending on onError
Then Talon-side we could map spoken forms as follows:
{
"can": {"onSuccess": "useOriginal", "onError": "drop"},
"only": {"onSuccess": "useModified", "onError": "drop"},
"soft": {"onSuccess": "useModified", "onError": "useOriginal"},
}
Note that these spoken forms can't be used on their own; they are of the form {user.cursorlessErrorSuppressor} <user.cursorlessModifier>, and construct a composed modifier
See also #1006