Added page up and page down to the summary view.

Also fine scrolling to the listing view to make the keys more consistent.
This commit is contained in:
Andrew Hamilton 2016-01-28 18:39:40 +00:00
parent 678dc89cc9
commit e48bafd87b
3 changed files with 37 additions and 14 deletions

2
TODO
View file

@ -14,7 +14,6 @@ Todo
- Cache tools._python_version. - Cache tools._python_version.
- Determine if perl files are perl5 or perl6. - Determine if perl files are perl5 or perl6.
- Add bandit tool for python. - Add bandit tool for python.
- Add page up and page down to the summary.
Done Done
@ -158,6 +157,7 @@ Done
- Statuses' pretty names and variable names don't match. - Statuses' pretty names and variable names don't match.
- Removed the 'watching' toggle. - Removed the 'watching' toggle.
<- Its not really necessary, now that you can pause. <- Its not really necessary, now that you can pause.
- Add page up and page down to the summary.
A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps
A B C D E F G H A B C D E F G H

View file

@ -18,8 +18,8 @@
 │  │
│Keys:  │ │Keys:  │
h - Show the help screen. (toggle)  │ h - Show the help screen. (toggle)  │
d, c, j, k or arrow keys or mouse c │ d, c, j, k, f, v or arrow keys or m │
D, C, J, K or page up, page down, h │ D, C, J, K, F, V or page up, page d │
│ Scroll the result pane.  │ │ Scroll the result pane.  │
t - Turn the result pane to portrai │ t - Turn the result pane to portrai │
l - Show the activity log. (toggle) │ l - Show the activity log. (toggle) │

45
vigil
View file

@ -24,8 +24,8 @@ e.g. # vigil my_project
Keys: Keys:
*h - Show the help screen. (toggle) *h - Show the help screen. (toggle)
*d, *c, *j, *k or arrow keys or mouse click - Move the cursor. *d, *c, *j, *k, *f, *v or arrow keys or mouse click - Move the cursor.
*D, *C, *J, *K or page up, page down, home, end or the mouse wheel - *D, *C, *J, *K, *F, *V or page up, page down, home, end or the mouse wheel -
Scroll the result pane. Scroll the result pane.
*t - Turn the result pane to portrait or landscape orientation. (toggle) *t - Turn the result pane to portrait or landscape orientation. (toggle)
*l - Show the activity log. (toggle) *l - Show the activity log. (toggle)
@ -429,6 +429,14 @@ class Summary:
def cursor_down(self): def cursor_down(self):
self._move_cursor(0, 1) self._move_cursor(0, 1)
def cursor_page_up(self):
view_width, view_height = self._view_widget.portal.last_dimensions
self._move_cursor(0, -(view_height - 1))
def cursor_page_down(self):
view_width, view_height = self._view_widget.portal.last_dimensions
self._move_cursor(0, view_height - 1)
def _issue_generator(self): def _issue_generator(self):
x, y = self.cursor_position() x, y = self.cursor_position()
for index in range(len(self._column) + 1): for index in range(len(self._column) + 1):
@ -651,13 +659,20 @@ class Screen:
def cursor_left(self): def cursor_left(self):
self._summary.cursor_left() self._summary.cursor_left()
def cursor_page_up(self):
self._summary.cursor_page_up()
def cursor_page_down(self):
self._summary.cursor_page_down()
def _move_listing(self, dx, dy): def _move_listing(self, dx, dy):
listing_width, listing_height = self._listing.widget.last_dimensions
selected_widget = self._summary.get_selection() selected_widget = self._summary.get_selection()
x, y = selected_widget.scroll_position x, y = selected_widget.scroll_position
selected_widget.scroll_position = \ selected_widget.scroll_position = max(x + dx, 0), max(y + dy, 0)
(max(x + dx * (listing_width // 2), 0),
max(y + dy * (listing_height // 2), 0)) def _page_listing(self, dx, dy):
listing_width, listing_height = self._listing.widget.last_dimensions
self._move_listing(dx * (listing_width // 2), dy * (listing_height // 2))
def listing_up(self): def listing_up(self):
self._move_listing(0, -1) self._move_listing(0, -1)
@ -666,10 +681,16 @@ class Screen:
self._move_listing(0, 1) self._move_listing(0, 1)
def listing_right(self): def listing_right(self):
self._move_listing(1, 0) self._page_listing(1, 0)
def listing_left(self): def listing_left(self):
self._move_listing(-1, 0) self._page_listing(-1, 0)
def listing_page_up(self):
self._page_listing(0, -1)
def listing_page_down(self):
self._page_listing(0, 1)
def move_to_next_issue(self): def move_to_next_issue(self):
self._summary.move_to_next_issue() self._summary.move_to_next_issue()
@ -759,7 +780,7 @@ class Screen:
self._appearance_changed_event.set() self._appearance_changed_event.set()
_STATUS_BAR = _highlight_chars( _STATUS_BAR = _highlight_chars(
" *help *quit *d,*c,*j,*k:navigate *turn *log *edit *next *pause" " *help *quit *d,*c,*j,*k,*f,*v:navigate *turn *log *edit *next *pause"
" *order *statuses", Log.GREEN_STYLE) " *order *statuses", Log.GREEN_STYLE)
@functools.lru_cache(maxsize=2) @functools.lru_cache(maxsize=2)
@ -804,8 +825,10 @@ class Screen:
({"t"}, toggle_window_orientation), ({"l"}, toggle_log), ({"t"}, toggle_window_orientation), ({"l"}, toggle_log),
({"h"}, toggle_help), ({"d", "up"}, cursor_up), ({"h"}, toggle_help), ({"d", "up"}, cursor_up),
({"c", "down"}, cursor_down), ({"j", "left"}, cursor_left), ({"c", "down"}, cursor_down), ({"j", "left"}, cursor_left),
({"k", "right"}, cursor_right), ({"D", "page up"}, listing_up), ({"k", "right"}, cursor_right), ({"v"}, cursor_page_down),
({"C", "page down"}, listing_down), ({"J", "home"}, listing_left), ({"f"}, cursor_page_up), ({"F", "page up"}, listing_page_up),
({"V", "page down"}, listing_page_down), ({"D"}, listing_up),
({"C"}, listing_down), ({"J", "home"}, listing_left),
({"K", "end"}, listing_right), ({"o"}, toggle_sort), ({"K", "end"}, listing_right), ({"o"}, toggle_sort),
({"n"}, move_to_next_issue), ({"N"}, move_to_next_issue_of_tool), ({"n"}, move_to_next_issue), ({"N"}, move_to_next_issue_of_tool),
({"e"}, edit_file), ({"s"}, toggle_status_style), ({"q"}, quit_), ({"e"}, edit_file), ({"s"}, toggle_status_style), ({"q"}, quit_),