Permalink
Browse files

Allow double-tapping tab to fully disclose pager, per #291

  • Loading branch information...
ridiculousfish committed Feb 20, 2014
1 parent adf5b03 commit 8eaabacf44698f7cde0c4d10cecb76c06b51b1b7
Showing with 22 additions and 3 deletions.
  1. +9 −1 pager.cpp
  2. +3 −0 pager.h
  3. +10 −2 reader.cpp
View
@@ -449,7 +449,9 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co
int term_width = this->available_term_width;
int term_height = this->available_term_height - 1 - (search_field_shown ? 1 : 0); // we always subtract 1 to make room for a comment row
if (! this->fully_disclosed)
+ {
term_height = mini(term_height, PAGER_UNDISCLOSED_MAX_ROWS);
+ }
size_t row_count = divide_round_up(lst.size(), cols);
@@ -691,7 +693,8 @@ void pager_t::update_rendering(page_rendering_t *rendering) const
rendering->selected_completion_idx != this->visual_selected_completion_index(rendering->rows, rendering->cols) ||
rendering->search_field_shown != this->search_field_shown ||
rendering->search_field_line.text != this->search_field_line.text ||
- rendering->search_field_line.position != this->search_field_line.position)
+ rendering->search_field_line.position != this->search_field_line.position ||
+ (rendering->remaining_to_disclose > 0 && this->fully_disclosed))
{
*rendering = this->render();
}
@@ -934,6 +937,11 @@ bool pager_t::is_navigating_contents() const
return selected_completion_idx != PAGER_SELECTION_NONE;
}
+void pager_t::set_fully_disclosed(bool flag)
+{
+ fully_disclosed = flag;
+}
+
const completion_t *pager_t::selected_completion(const page_rendering_t &rendering) const
{
const completion_t * result = NULL;
View
@@ -159,6 +159,9 @@ class pager_t
/* Indicates if we are navigating our contents */
bool is_navigating_contents() const;
+ /* Become fully disclosed */
+ void set_fully_disclosed(bool flag);
+
/* Position of the cursor */
size_t cursor_position() const;
View
@@ -3337,8 +3337,16 @@ const wchar_t *reader_readline(void)
editable_line_t *el = &data->command_line;
if (data->is_navigating_pager_contents() || (! comp_empty && last_char == R_COMPLETE))
{
- /* The user typed R_COMPLETE more than once in a row. Cycle through our available completions. */
- select_completion_in_direction(c == R_COMPLETE ? direction_next : direction_prev);
+ /* The user typed R_COMPLETE more than once in a row. If we are not yet fully disclosed, then become so; otherwise cycle through our available completions. */
+ if (data->current_page_rendering.remaining_to_disclose > 0)
+ {
+ data->pager.set_fully_disclosed(true);
+ reader_repaint_needed();
+ }
+ else
+ {
+ select_completion_in_direction(c == R_COMPLETE ? direction_next : direction_prev);
+ }
}
else
{

0 comments on commit 8eaabac

Please sign in to comment.