Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333630
b: refs/heads/master
c: 1d1e2ca
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Poirier authored and Michal Marek committed Sep 27, 2012
1 parent de3336a commit 6f73561
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 537ddae75c0f41343928d39f308f3ca670f000a8
refs/heads/master: 1d1e2caebbf1f4f25ad473e90650cdc9291fdd22
2 changes: 1 addition & 1 deletion trunk/scripts/kconfig/lxdialog/dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width);
int dialog_msgbox(const char *title, const char *prompt, int height,
int width, int pause);
int dialog_textbox(const char *title, const char *file, int height, int width,
int *keys);
int *keys, int *_vscroll, int *_hscroll);
int dialog_menu(const char *title, const char *prompt,
const void *selected, int *s_scroll);
int dialog_checklist(const char *title, const char *prompt, int height,
Expand Down
24 changes: 23 additions & 1 deletion trunk/scripts/kconfig/lxdialog/textbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw,
* keys is a null-terminated array
*/
int dialog_textbox(const char *title, const char *tbuf, int initial_height,
int initial_width, int *keys)
int initial_width, int *keys, int *_vscroll, int *_hscroll)
{
int i, x, y, cur_x, cur_y, key = 0;
int height, width, boxh, boxw;
Expand All @@ -65,6 +65,15 @@ int dialog_textbox(const char *title, const char *tbuf, int initial_height,
buf = tbuf;
page = buf; /* page is pointer to start of page to be displayed */

if (_vscroll && *_vscroll) {
begin_reached = 0;

for (i = 0; i < *_vscroll; i++)
get_line();
}
if (_hscroll)
hscroll = *_hscroll;

do_resize:
getmaxyx(stdscr, height, width);
if (height < 8 || width < 8)
Expand Down Expand Up @@ -275,6 +284,19 @@ int dialog_textbox(const char *title, const char *tbuf, int initial_height,
}
delwin(box);
delwin(dialog);
if (_vscroll) {
const char *s;

s = buf;
*_vscroll = 0;
back_lines(page_length);
while (s < page && (s = strchr(s, '\n'))) {
(*_vscroll)++;
s++;
}
}
if (_hscroll)
*_hscroll = hscroll;
return key;
}

Expand Down
8 changes: 4 additions & 4 deletions trunk/scripts/kconfig/mconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ static void conf_string(struct menu *menu);
static void conf_load(void);
static void conf_save(void);
static int show_textbox_ext(const char *title, const char *text, int r, int c,
int *keys);
int *keys, int *vscroll, int *hscroll);
static void show_textbox(const char *title, const char *text, int r, int c);
static void show_helptext(const char *title, const char *text);
static void show_help(struct menu *menu);
Expand Down Expand Up @@ -621,15 +621,15 @@ static void conf(struct menu *menu)
}

static int show_textbox_ext(const char *title, const char *text, int r, int c,
int *keys)
int *keys, int *vscroll, int *hscroll)
{
dialog_clear();
return dialog_textbox(title, text, r, c, keys);
return dialog_textbox(title, text, r, c, keys, vscroll, hscroll);
}

static void show_textbox(const char *title, const char *text, int r, int c)
{
show_textbox_ext(title, text, r, c, (int []) {0});
show_textbox_ext(title, text, r, c, (int []) {0}, NULL, NULL);
}

static void show_helptext(const char *title, const char *text)
Expand Down

0 comments on commit 6f73561

Please sign in to comment.