aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-21 00:57:08 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2011-06-21 00:57:08 +0200
commit10c8645d3380167dba8acd1701ca8473ca2efa36 (patch)
tree47e83aaeb00d8c7030b2ee6a2e7645f8ececc49a
parent528bb3f1bed14700793bb758be43f446e16a00c0 (diff)
downloadpowerdebug-10c8645d3380167dba8acd1701ca8473ca2efa36.tar.gz
handle the scrolling with the search result list
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--display.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/display.c b/display.c
index e1d1325..8f442c1 100644
--- a/display.c
+++ b/display.c
@@ -281,9 +281,10 @@ struct find_data {
char *string;
regex_t *reg;
int ocursor;
+ int oscrolling;
};
-struct find_data *display_find_form_init(void)
+struct find_data *display_find_init(void)
{
const char *regexp = "^[a-z|0-9|_|-|.]";
struct find_data *findd;
@@ -318,8 +319,12 @@ struct find_data *display_find_form_init(void)
* browse the search result
*/
findd->ocursor = windata[current_win].cursor;
+ findd->oscrolling = windata[current_win].scrolling;
+
windata[current_win].cursor = 0;
+ windata[current_win].scrolling = 0;
+ curs_set(1);
out:
return findd;
@@ -333,12 +338,13 @@ out_free_reg:
goto out;
}
-static void display_find_form_fini(struct find_data *fd)
+static void display_find_fini(struct find_data *findd)
{
- windata[current_win].cursor = fd->ocursor;
- regfree(fd->reg);
- free(fd->string);
- free(fd);
+ windata[current_win].cursor = findd->ocursor;
+ windata[current_win].scrolling = findd->oscrolling;
+ regfree(findd->reg);
+ free(findd->string);
+ free(findd);
curs_set(0);
}
@@ -346,7 +352,7 @@ static int display_switch_to_find(int fd)
{
struct find_data *findd;
- findd = display_find_form_init();
+ findd = display_find_init();
if (!findd)
return -1;
@@ -439,7 +445,7 @@ static int display_find_keystroke(int fd, void *data)
switch (keystroke) {
case '\e':
- display_find_form_fini(findd);
+ display_find_fini(findd);
return display_switch_to_main(fd);
case KEY_DOWN:
@@ -453,6 +459,10 @@ static int display_find_keystroke(int fd, void *data)
case KEY_BACKSPACE:
if (strlen(string))
string[strlen(string) - 1] = '\0';
+
+ windata[current_win].cursor = 0;
+ windata[current_win].scrolling = 0;
+
break;
case '\r':
@@ -473,6 +483,9 @@ static int display_find_keystroke(int fd, void *data)
if (strlen(string) < findd->len - 1)
string[strlen(string)] = (char)keystroke;
+ windata[current_win].cursor = 0;
+ windata[current_win].scrolling = 0;
+
break;
}