Skip to content

Commit

Permalink
Feat: Shortcut to clear search bar
Browse files Browse the repository at this point in the history
- Resolves #241
  • Loading branch information
FS authored and yannik-dittmar committed May 17, 2022
1 parent ee881e5 commit 5ae6b41
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
initialization
initializeGlobalKeyBindings

KeyBindings := Dictionary newFrom:
{ '<down>' -> [:anEvent :morph | morph selectNext].
'<up>' -> [:anEvent :morph | morph selectPrevious].
'<tab>' -> [:anEvent :morph | morph showChildListOrDoAction: anEvent].
'<tab>' -> [:anEvent :morph | morph showChildListOrDoAction: anEvent].
'<Shift-tab>' -> [:anEvent :morph | morph showParentList].
'<escape>' -> [:anEvent :morph | morph deactivate: anEvent hand].
'<cr>' -> [:anEvent :morph | morph doActionOnSelectedEvent:anEvent] }
'<cr>' -> [:anEvent :morph | morph doActionOnSelectedEvent: anEvent].
'<Ctrl-delete>' -> [:anEvent :morph | morph clearSearchBar: anEvent] }
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
events-processing
clearSearchBar: event

self active
ifTrue: [
self query: ''.
self resetFilteringThreshold.
self isStepping ifFalse: [self startStepping].
self grabFocus: self activeHand]

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
event handling
grabFocus: hand

hand
newKeyboardFocus: self textField.
newKeyboardFocus: self textField
5 changes: 3 additions & 2 deletions packages/Algernon.package/ALGCore.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"initializeActivationString" : "fsa 6/20/2021 14:10",
"initializeActivationStringForPlatform:" : "fsa 6/26/2021 14:17",
"initializeAlgernon" : "mt 10/20/2015 14:32:03",
"initializeGlobalKeyBindings" : "b 6/21/2021 11:44",
"initializeGlobalKeyBindings" : "fs 5/12/2022 18:41",
"keyBindings" : "J.J. 7/31/2015 20:31",
"maxHalfClickDeviation" : "b 6/16/2021 01:47",
"maximumPerCategory" : "OH 5/12/2021 22:16",
Expand Down Expand Up @@ -57,6 +57,7 @@
"breadcrumbs" : "J.J. 7/16/2015 22:51",
"breadcrumbs:" : "J.J. 7/27/2015 20:20",
"checkWorldBounds" : "rk 6/29/2020 01:09",
"clearSearchBar:" : "fs 5/12/2022 19:01",
"currentItem" : "J.J. 7/30/2015 20:25",
"deactivate" : "topa 3/24/2015 14:11",
"deactivate:" : "jRo 8/5/2020 15:10",
Expand All @@ -66,7 +67,7 @@
"filteringThreshold" : "DS 5/21/2017 16:54",
"firstOnSearchStack" : "jRo 6/14/2020 18:21",
"firstStep:" : "DS 5/21/2017 16:43",
"grabFocus:" : "b 6/2/2021 00:59",
"grabFocus:" : "fs 5/12/2022 18:58",
"handleActivationKeyEvent:" : "NM 6/30/2021 14:43",
"handleAsQuickAccess:" : "NM 6/7/2021 21:22",
"handleListenEvent:" : "NM 6/30/2021 14:45",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
testing
testShortcutToClearSearchBar
| sampleKeyboardEvent deleteKeyboardEvent |
sampleKeyboardEvent := ALGFakeKeyboardEvent new keyString: 'A';
keyValue: 65;
buttons: 0;
isKeyUp: true.
deleteKeyboardEvent := ALGFakeKeyboardEvent new keyString: '<Ctrl-delete>'.
self algInstance keyStroke: sampleKeyboardEvent.
self algInstance keyStroke: sampleKeyboardEvent.
self assert: self algInstance query equals: 'AA'.
self algInstance keyStroke: deleteKeyboardEvent.
self assert: self algInstance query equals: ''


Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
"testNormalKeyStrokesSetsCursorColor" : "NL 6/1/2021 16:32",
"testNumberTriggersItem" : "b 8/5/2021 16:12",
"testScrollingInputField" : "NM 6/1/2021 20:52",
"testSelfFocus" : "NL 6/1/2021 15:27" } }
"testSelfFocus" : "NL 6/1/2021 15:27",
"testShortcutToClearSearchBar" : "fs 5/12/2022 15:40" } }

0 comments on commit 5ae6b41

Please sign in to comment.