@@ -234,7 +234,27 @@ int display_refresh(void)
return 0;
}
-int display_select(void)
+int display_refresh_pad(int win)
+{
+ return prefresh(windata[win].pad, windata[win].scrolling,
+ 0, 2, 0, maxy - 2, maxx);
+}
+
+static int display_show_unselection(int win, int line, bool bold)
+{
+ if (mvwchgat(windata[win].pad, line, 0, -1,
+ bold ? WA_BOLD: WA_NORMAL, 0, NULL) < 0)
+ return -1;
+
+ return display_refresh_pad(win);
+}
+
+void *display_get_row_data(int win)
+{
+ return windata[win].rowdata[windata[win].cursor].data;
+}
+
+static int display_select(void)
{
if (windata[current_win].ops && windata[current_win].ops->select)
return windata[current_win].ops->select();
@@ -242,7 +262,7 @@ int display_select(void)
return 0;
}
-int display_next_panel(void)
+static int display_next_panel(void)
{
size_t array_size = sizeof(windata) / sizeof(windata[0]);
@@ -252,7 +272,7 @@ int display_next_panel(void)
return current_win;
}
-int display_prev_panel(void)
+static int display_prev_panel(void)
{
size_t array_size = sizeof(windata) / sizeof(windata[0]);
@@ -263,27 +283,53 @@ int display_prev_panel(void)
return current_win;
}
-int display_refresh_pad(int win)
+static int display_next_line(void)
{
- return prefresh(windata[win].pad, windata[win].scrolling,
- 0, 2, 0, maxy - 2, maxx);
-}
+ int cursor = windata[current_win].cursor;
+ int nrdata = windata[current_win].nrdata;
+ int scrolling = windata[current_win].scrolling;
+ struct rowdata *rowdata = windata[current_win].rowdata;
-int display_show_unselection(int win, int line, bool bold)
-{
- if (mvwchgat(windata[win].pad, line, 0, -1,
- bold ? WA_BOLD: WA_NORMAL, 0, NULL) < 0)
- return -1;
+ if (cursor >= nrdata)
+ return cursor;
- return display_refresh_pad(win);
+ display_show_unselection(current_win, cursor, rowdata[cursor].attr);
+ if (cursor < nrdata - 1) {
+ if (cursor >= (maxy - 4 + scrolling))
+ scrolling++;
+ cursor++;
+ }
+
+ windata[current_win].scrolling = scrolling;
+ windata[current_win].cursor = cursor;
+
+ return cursor;
}
-void *display_get_row_data(int win)
+static int display_prev_line(void)
{
- return windata[win].rowdata[windata[win].cursor].data;
+ int cursor = windata[current_win].cursor;
+ int nrdata = windata[current_win].nrdata;
+ int scrolling = windata[current_win].scrolling;
+ struct rowdata *rowdata = windata[current_win].rowdata;
+
+ if (cursor >= nrdata)
+ return cursor;
+
+ display_show_unselection(current_win, cursor, rowdata[cursor].attr);
+ if (cursor > 0) {
+ if (cursor <= scrolling)
+ scrolling--;
+ cursor--;
+ }
+
+ windata[current_win].scrolling = scrolling;
+ windata[current_win].cursor = cursor;
+
+ return cursor;
}
-int display_set_row_data(int win, int line, void *data, int attr)
+static int display_set_row_data(int win, int line, void *data, int attr)
{
struct rowdata *rowdata = windata[win].rowdata;
@@ -332,52 +378,6 @@ int display_print_line(int win, int line, char *str, int bold, void *data)
return 0;
}
-int display_next_line(void)
-{
- int cursor = windata[current_win].cursor;
- int nrdata = windata[current_win].nrdata;
- int scrolling = windata[current_win].scrolling;
- struct rowdata *rowdata = windata[current_win].rowdata;
-
- if (cursor >= nrdata)
- return cursor;
-
- display_show_unselection(current_win, cursor, rowdata[cursor].attr);
- if (cursor < nrdata - 1) {
- if (cursor >= (maxy - 4 + scrolling))
- scrolling++;
- cursor++;
- }
-
- windata[current_win].scrolling = scrolling;
- windata[current_win].cursor = cursor;
-
- return cursor;
-}
-
-int display_prev_line(void)
-{
- int cursor = windata[current_win].cursor;
- int nrdata = windata[current_win].nrdata;
- int scrolling = windata[current_win].scrolling;
- struct rowdata *rowdata = windata[current_win].rowdata;
-
- if (cursor >= nrdata)
- return cursor;
-
- display_show_unselection(current_win, cursor, rowdata[cursor].attr);
- if (cursor > 0) {
- if (cursor <= scrolling)
- scrolling--;
- cursor--;
- }
-
- windata[current_win].scrolling = scrolling;
- windata[current_win].cursor = cursor;
-
- return cursor;
-}
-
int display_keystroke(void *data)
{
int *tick = data;
Make some functions static as they are no longer out of the scope of the display code. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- display.c | 124 ++++++++++++++++++++++++++++++------------------------------ 1 files changed, 62 insertions(+), 62 deletions(-)