summaryrefslogtreecommitdiff
path: root/kconfig/nconf.gui.c
diff options
context:
space:
mode:
authorBryan Hundven <bryanhundven@gmail.com>2018-02-01 00:39:45 (GMT)
committerBryan Hundven <bryanhundven@gmail.com>2018-02-01 00:39:45 (GMT)
commit59b08f8d06700770cf1105269acb2ec2460e2a34 (patch)
tree7e26466ff1bdcb344d223d27c24a2014ff54a38f /kconfig/nconf.gui.c
parentba165ed4c0bfa8a83e61a2efd1ad205777978486 (diff)
Sync kconfig files with upstream 4.15
Last updated with 4.9-rc7. This commit introduces the following upstream changes: 9059a3493efe kconfig: fix relational operators for bool and tristate symbols 88127dae6ed9 kconfig/symbol.c: use correct pointer type argument for sizeof b24413180f56 License cleanup: add SPDX GPL-2.0 license identifier to files with no license bb3290d91695 Remove gperf usage from toolchain ad8181060788 kconfig: fix sparse warnings in nconfig ff85a1a80e00 kconfig: Check for libncurses before menuconfig 9be3213b14d4 gconfig: remove misleading parentheses around a condition 83c3a1bad224 xconfig: fix missing suboption and help panels on first run e039303ff71a xconfig: fix 'Show Debug' functionality 79e51b5c2dee kconfig/nconf: Fix hang when editing symbol with a long prompt 0eb47346968f Scripts: kconfig: nconf: fix _GNU_SOURCE redefined warning 237e3ad0f195 Kconfig: Introduce the "imply" keyword Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Diffstat (limited to 'kconfig/nconf.gui.c')
-rw-r--r--kconfig/nconf.gui.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/kconfig/nconf.gui.c b/kconfig/nconf.gui.c
index 8275f0e..a64b1c3 100644
--- a/kconfig/nconf.gui.c
+++ b/kconfig/nconf.gui.c
@@ -129,7 +129,7 @@ static void no_colors_theme(void)
mkattrn(FUNCTION_TEXT, A_REVERSE);
}
-void set_colors()
+void set_colors(void)
{
start_color();
use_default_colors();
@@ -192,7 +192,7 @@ const char *get_line(const char *text, int line_no)
int lines = 0;
if (!text)
- return 0;
+ return NULL;
for (i = 0; text[i] != '\0' && lines < line_no; i++)
if (text[i] == '\n')
@@ -364,12 +364,14 @@ int dialog_inputbox(WINDOW *main_window,
WINDOW *prompt_win;
WINDOW *form_win;
PANEL *panel;
- int i, x, y;
+ int i, x, y, lines, columns, win_lines, win_cols;
int res = -1;
int cursor_position = strlen(init);
int cursor_form_win;
char *result = *resultp;
+ getmaxyx(stdscr, lines, columns);
+
if (strlen(init)+1 > *result_len) {
*result_len = strlen(init)+1;
*resultp = result = realloc(result, *result_len);
@@ -386,14 +388,19 @@ int dialog_inputbox(WINDOW *main_window,
if (title)
prompt_width = max(prompt_width, strlen(title));
+ win_lines = min(prompt_lines+6, lines-2);
+ win_cols = min(prompt_width+7, columns-2);
+ prompt_lines = max(win_lines-6, 0);
+ prompt_width = max(win_cols-7, 0);
+
/* place dialog in middle of screen */
- y = (getmaxy(stdscr)-(prompt_lines+4))/2;
- x = (getmaxx(stdscr)-(prompt_width+4))/2;
+ y = (lines-win_lines)/2;
+ x = (columns-win_cols)/2;
strncpy(result, init, *result_len);
/* create the windows */
- win = newwin(prompt_lines+6, prompt_width+7, y, x);
+ win = newwin(win_lines, win_cols, y, x);
prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2);
form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
keypad(form_win, TRUE);