aboutsummaryrefslogtreecommitdiff
path: root/view.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2017-06-11 21:58:33 +0200
committerMarc André Tanner <mat@brain-dump.org>2017-06-15 15:51:42 +0200
commit2fa1bea119b211b306281bc3688dee7af7889169 (patch)
treea4950060028cf3f0d536185d088bd1ab5194f08a /view.c
parent9d9896d89cfc4ec2f549caad53f2386f15a202bb (diff)
downloadvis-2fa1bea119b211b306281bc3688dee7af7889169.tar.gz
vis-2fa1bea119b211b306281bc3688dee7af7889169.tar.xz
view: clean up and add documentation
Diffstat (limited to 'view.c')
-rw-r--r--view.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/view.c b/view.c
index 2106b0e..b891ef0 100644
--- a/view.c
+++ b/view.c
@@ -105,6 +105,14 @@ static const SyntaxSymbol symbols_default[] = {
static Cell cell_unused;
+
+/* move visible viewport n-lines up/down, redraws the view but does not change
+ * cursor position which becomes invalid and should be corrected by calling
+ * view_cursor_to. the return value indicates wether the visible area changed.
+ */
+static bool view_viewport_up(View *view, int n);
+static bool view_viewport_down(View *view, int n);
+
static void view_clear(View *view);
static bool view_addch(View *view, Cell *cell);
static void view_cursors_free(Cursor *c);
@@ -549,7 +557,7 @@ static size_t cursor_set(Cursor *cursor, Line *line, int col) {
return pos;
}
-bool view_viewport_down(View *view, int n) {
+static bool view_viewport_down(View *view, int n) {
Line *line;
if (view->end >= text_size(view->text))
return false;
@@ -563,7 +571,7 @@ bool view_viewport_down(View *view, int n) {
return true;
}
-bool view_viewport_up(View *view, int n) {
+static bool view_viewport_up(View *view, int n) {
/* scrolling up is somewhat tricky because we do not yet know where
* the lines start, therefore scan backwards but stop at a reasonable
* maximum in case we are dealing with a file without any newlines