title: $:/core/macros/keyboard-driven-input tags: $:/tags/Macro \define keyboard-input-actions() <$list filter="[<__index__>match[]]"> <$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>get<__field__>] }}}/> <$list filter="[<__index__>!match[]]"> <$action-setfield $tiddler=<<__storeTitle__>> text={{{ [<__tiddler__>getindex<__index__>] }}}/> \end \define input-next-actions(afterOrBefore:"after",reverse:"") <$list filter="[<__storeTitle__>get[text]minlength<__filterMinLength__>] [<__filterMinLength__>match[0]] +[limit[1]]" variable="ignore"> <$vars userInput={{{ [<__storeTitle__>get[text]] }}} selectedItem={{{ [<__selectionStateTitle__>get[text]] }}}> <$set name="filteredList" filter="[subfilter<__primaryListFilter__>addsuffix[-primaryList]] =[subfilter<__secondaryListFilter__>addsuffix[-secondaryList]]"> <$set name="nextItem" value={{{ [enlist$afterOrBefore$] ~[enlist$reverse$nth[1]] }}}> <$list filter="[minlength[1]]"> <$action-setfield $tiddler=<<__selectionStateTitle__>> text=<>/> <$list filter="[<__index__>match[]]"> <$action-setfield $tiddler=<<__tiddler__>> $field=<<__field__>> $value={{{ [] +[splitregexp[(?:.(?!-))+$]] }}}/> <$list filter="[<__index__>!match[]]"> <$action-setfield $tiddler=<<__tiddler__>> $index=<<__index__>> $value={{{ [] +[splitregexp[(?:.(?!-))+$]] }}}/> <$action-setfield $tiddler=<<__refreshTitle__>> text="yes"/> \end \define keyboard-driven-input(tiddler,storeTitle,field:"text",index:"",tag:"input",type,focus:"",inputAcceptActions,inputAcceptVariantActions,inputCancelActions,placeholder:"",default:"",class,primaryListFilter,secondaryListFilter,focusPopup,rows,minHeight,tabindex,size,autoHeight,filterMinLength:"0",refreshTitle,selectionStateTitle,cancelPopups:"") <$keyboard key="((input-accept))" actions=<<__inputAcceptActions__>>> <$keyboard key="((input-accept-variant))" actions=<<__inputAcceptVariantActions__>>> <$keyboard key="((input-up))" actions=<>> <$keyboard key="((input-down))" actions=<>> <$keyboard key="((input-cancel))" actions=<<__inputCancelActions__>>> <$edit-text tiddler=<<__tiddler__>> field=<<__field__>> index=<<__index__>> inputActions=<> tag=<<__tag__>> class=<<__class__>> placeholder=<<__placeholder__>> default=<<__default__>> focusPopup=<<__focusPopup__>> focus=<<__focus__>> type=<<__type__>> rows=<<__rows__>> minHeight=<<__minHeight__>> tabindex=<<__tabindex__>> size=<<__size__>> autoHeight=<<__autoHeight__>> refreshTitle=<<__refreshTitle__>> cancelPopups=<<__cancelPopups__>>/> \end