aboutsummaryrefslogtreecommitdiffhomepage
path: root/pager.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-01-17 12:04:03 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-01-17 12:04:03 -0800
commitc6e5201e15daf86fc25857164d51d5b9f29e0808 (patch)
treec910c9ba411e546a952a85f992e9f8c7c2fc4e49 /pager.h
parent64b1b5ca38b3b2d5ccfb84a01d8ad13299b8c581 (diff)
Initial support for navigating completions that appear under the
commandline using arrow keys
Diffstat (limited to 'pager.h')
-rw-r--r--pager.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/pager.h b/pager.h
index 38c7f166..e53e919c 100644
--- a/pager.h
+++ b/pager.h
@@ -6,9 +6,18 @@
#include "screen.h"
/* Represents rendering from the pager */
-struct page_rendering_t
+class page_rendering_t
{
+ public:
+ int term_width;
+ int term_height;
+ size_t rows;
+ size_t cols;
+ size_t selected_completion_idx;
screen_data_t screen_data;
+
+ /* Returns a rendering with invalid data, useful to indicate "no rendering" */
+ page_rendering_t();
};
typedef std::vector<completion_t> completion_list_t;
@@ -79,9 +88,15 @@ class pager_t
/* Sets the index of the selected completion */
void set_selected_completion(size_t completion_idx);
+ /* Changes the selected completion in the given direction according to the layout of the given rendering. Returns true if the values changed. */
+ bool select_next_completion_in_direction(cardinal_direction_t direction, const page_rendering_t &rendering);
+
/* Produces a rendering of the completions, at the given term size */
page_rendering_t render() const;
+ /* Updates the rendering if it's stale */
+ void update_rendering(page_rendering_t *rendering) const;
+
/* Indicates if there are no completions, and therefore nothing to render */
bool empty() const;