summaryrefslogtreecommitdiff
path: root/scripts/kconfig/lxdialog/util.c
diff options
context:
space:
mode:
authorDirk Gouders <dirk@gouders.net>2013-05-12 12:30:49 +0200
committerYann E. MORIN <yann.morin.1998@free.fr>2013-06-18 23:58:58 +0200
commit4f2de3e19983dafca264b672152b36e4962ca1c3 (patch)
tree8d4b6fac4d7a4f4c7220918ee93f175ae4a01ff0 /scripts/kconfig/lxdialog/util.c
parent1376391621654cc369c5e8b60497f7c184f0ed47 (diff)
mconf: use function calls instead of ncurses' variables LINES and COLS
According to the documentation [1], LINES and COLS are initialized by initscr(); it does not say anything about the behavior when windows are resized. Do not rely on the current implementation of ncurses that updates these variables on resize, but use the propper function calls to get window dimensions. init_dialog() could make use of the variables, but for the sake of consistency we do not change it's current use of the macro getmaxyx(). [1] ncurses(3X) Signed-off-by: Dirk Gouders <dirk@gouders.net> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts/kconfig/lxdialog/util.c')
-rw-r--r--scripts/kconfig/lxdialog/util.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c
index 0fa567eb68c6..58a8289dd650 100644
--- a/scripts/kconfig/lxdialog/util.c
+++ b/scripts/kconfig/lxdialog/util.c
@@ -254,7 +254,12 @@ void attr_clear(WINDOW * win, int height, int width, chtype attr)
void dialog_clear(void)
{
- attr_clear(stdscr, LINES, COLS, dlg.screen.atr);
+ int lines, columns;
+
+ lines = getmaxy(stdscr);
+ columns = getmaxx(stdscr);
+
+ attr_clear(stdscr, lines, columns, dlg.screen.atr);
/* Display background title if it exists ... - SLH */
if (dlg.backtitle != NULL) {
int i, len = 0, skip = 0;
@@ -269,10 +274,10 @@ void dialog_clear(void)
}
wmove(stdscr, 1, 1);
- if (len > COLS - 2) {
+ if (len > columns - 2) {
const char *ellipsis = "[...] ";
waddstr(stdscr, ellipsis);
- skip = len - (COLS - 2 - strlen(ellipsis));
+ skip = len - (columns - 2 - strlen(ellipsis));
}
for (pos = dlg.subtitles; pos != NULL; pos = pos->next) {
@@ -298,7 +303,7 @@ void dialog_clear(void)
skip--;
}
- for (i = len + 1; i < COLS - 1; i++)
+ for (i = len + 1; i < columns - 1; i++)
waddch(stdscr, ACS_HLINE);
}
wnoutrefresh(stdscr);