-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Shortcut to clear search bar (#243)
* Feat: Shortcut to clear search bar - Resolves #241 * Refactor: Used a better update mechanism * Refac: Refactored the test Co-authored-by: Frederic Sadrieh <[email protected]> Co-authored-by: Georg Auge <[email protected]>
- Loading branch information
1 parent
ee881e5
commit 4bb9302
Showing
6 changed files
with
28 additions
and
7 deletions.
There are no files selected for viewing
7 changes: 4 additions & 3 deletions
7
packages/Algernon.package/ALGCore.class/class/initializeGlobalKeyBindings.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] } |
8 changes: 8 additions & 0 deletions
8
packages/Algernon.package/ALGCore.class/instance/clearSearchBar..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
events-processing | ||
clearSearchBar: event | ||
|
||
self active | ||
ifTrue: [ | ||
self query: ''. | ||
self updateItemList.] | ||
|
3 changes: 2 additions & 1 deletion
3
packages/Algernon.package/ALGCore.class/instance/grabFocus..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...ages/AlgernonTests.package/ALGTestKeyboard.class/instance/testShortcutToClearSearchBar.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
testing | ||
testShortcutToClearSearchBar | ||
| keyboardEvent | | ||
keyboardEvent := ALGFakeKeyboardEvent new keyString: '<Ctrl-delete>'. | ||
self runQuery: 'example string'. | ||
self algInstance keyStroke: keyboardEvent. | ||
self assert: self algInstance query equals: '' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters