summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/utils.c b/src/utils.c
index 28a7891..d4210c1 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -212,22 +212,17 @@ popup (int pop_row, int pop_col, int pop_y, int pop_x, char *title, char *msg,
void
print_in_middle (WINDOW *win, int starty, int startx, int width, char *string)
{
- int length, x, y;
- float temp;
+ int len = strlen (string);
+ int x, y;
- if (win == NULL)
- win = stdscr;
+ if (!win) win = stdscr;
getyx (win, y, x);
- if (startx != 0)
- x = startx;
- if (starty != 0)
- y = starty;
- if (width == 0)
- width = 80;
-
- length = strlen (string);
- temp = (width - length) / 2;
- x = startx + (int) temp;
+ if (startx) x = startx;
+ if (starty) y = starty;
+ if (!width) width = 80;
+
+ x += (width - len) / 2;
+
custom_apply_attr (win, ATTR_HIGHEST);
mvwprintw (win, y, x, "%s", string);
custom_remove_attr (win, ATTR_HIGHEST);