summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/util.c b/src/util.c
index d7426526..5d178780 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3288,21 +3288,22 @@ bool askfor_aux(char *buf, int len)
int k = 0;
+ int wid, hgt;
+
bool done = FALSE;
/* Locate the cursor */
Term_locate(&x, &y);
-
- /* Paranoia -- check len */
- if (len < 1) len = 1;
+ /* Get terminal size */
+ Term_get_size(&wid, &hgt);
/* Paranoia -- check column */
- if ((x < 0) || (x >= 80)) x = 0;
+ if ((x < 0) || (x >= wid)) x = 0;
/* Restrict the length */
- if (x + len > 80) len = 80 - x;
+ if (x + len > wid) len = wid - x;
/* Paranoia -- Clip the default entry */