Skip to content
Snippets Groups Projects
Commit cbe39977 authored by Dimitar Pashov's avatar Dimitar Pashov
Browse files

quick & dirty patch for smap to compile with reentrant ncurses

Smap seems to be ok with this. The proper approach would be to root out
all usage of the global COLS and LINES and switch to local variables,
as section 'Some Notes of Caution' of the ncurses intro suggests.
parent 06a629e9
No related branches found
No related tags found
No related merge requests found
...@@ -184,13 +184,11 @@ int main(int argc, char *argv[]) ...@@ -184,13 +184,11 @@ int main(int argc, char *argv[])
if (params.cluster_dims == 4) { if (params.cluster_dims == 4) {
startx = width; startx = width;
COLS -= 2; width = COLS - width - 2;
width = COLS - width;
height = LINES; height = LINES;
} else if (params.cluster_dims == 3) { } else if (params.cluster_dims == 3) {
startx = width; startx = width;
COLS -= 2; width = COLS - width - 2;
width = COLS - width;
height = LINES; height = LINES;
} else { } else {
startx = 0; startx = 0;
...@@ -476,11 +474,8 @@ static void *_resize_handler(int sig) ...@@ -476,11 +474,8 @@ static void *_resize_handler(int sig)
delwin(text_win); delwin(text_win);
endwin(); endwin();
COLS = 0;
LINES = 0;
initscr(); initscr();
doupdate(); /* update now to make sure we get the new size */ doupdate(); /* update now to make sure we get the new size */
getmaxyx(stdscr, LINES, COLS);
if (params.cluster_dims == 4) { if (params.cluster_dims == 4) {
height = dim_size[2] * dim_size[3] + dim_size[2] + 3; height = dim_size[2] * dim_size[3] + dim_size[2] + 3;
...@@ -508,13 +503,11 @@ static void *_resize_handler(int sig) ...@@ -508,13 +503,11 @@ static void *_resize_handler(int sig)
if (params.cluster_dims == 4) { if (params.cluster_dims == 4) {
startx = width; startx = width;
COLS -= 2; width = COLS - width - 2;
width = COLS - width;
height = LINES; height = LINES;
} else if (params.cluster_dims == 3) { } else if (params.cluster_dims == 3) {
startx = width; startx = width;
COLS -= 2; width = COLS - width - 2;
width = COLS - width;
height = LINES; height = LINES;
} else { } else {
startx = 0; startx = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment