Skip to content

Commit

Permalink
Merge pull request #229 from robertbachmann/home-end
Browse files Browse the repository at this point in the history
Add suport for 'Home' and 'End' keys
  • Loading branch information
pcottle committed Apr 5, 2016
2 parents b22b25f + 4936648 commit 8922375
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/__tests__/expected/longListEndKey.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
=== dummy97.txt
___________
. dummy98.txt
___________
. dummy99.txt
___________
. dummy100.txt
BBBBBBBBBBBB
.

.

.

/-\

\-/ ___________________________________________________________________________

=== [f|A] selection, [down|j|up|k|space|b] navigation, [enter] open, [x] quick

20 changes: 20 additions & 0 deletions src/__tests__/expected/longListHomeKey.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
=== dummy1.txt
BBBBBBBBBB
\-/ dummy2.txt
__________
. dummy3.txt
__________
. dummy4.txt
__________
. dummy5.txt
__________
. dummy6.txt
__________
.

.

. ___________________________________________________________________________

=== [f|A] selection, [down|j|up|k|space|b] navigation, [enter] open, [x] quick

18 changes: 18 additions & 0 deletions src/__tests__/testScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,24 @@
'input': 'longList.txt',
'inputs': ['NPAGE', 'NPAGE','NPAGE', 'PPAGE'],
'validateFileExists': False,
}, {
'name': 'longListHomeKey',
'input': 'longList.txt',
'inputs': [' ', ' ','HOME'],
'withAttributes': True,
'validateFileExists': False,
'screenConfig': {
'maxY': 10
}
}, {
'name': 'longListEndKey',
'input': 'longList.txt',
'inputs': ['END'],
'withAttributes': True,
'validateFileExists': False,
'screenConfig': {
'maxY': 10
}
}]


Expand Down
4 changes: 2 additions & 2 deletions src/screenControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ def processInput(self, key):
self.pageDown()
elif key == 'b' or key == 'PPAGE':
self.pageUp()
elif key == 'g':
elif key == 'g' or key == 'HOME':
self.jumpToIndex(0)
elif key == 'G' and not self.mode == X_MODE:
elif (key == 'G' and not self.mode == X_MODE) or key == 'END':
self.jumpToIndex(self.numMatches - 1)
elif key == 'f':
self.toggleSelect()
Expand Down

0 comments on commit 8922375

Please sign in to comment.