From f239a04691bfbf4f96d462c71ca4534120be0ebf Mon Sep 17 00:00:00 2001 From: martin Date: Fri, 1 Mar 2019 17:02:21 +0000 Subject: [PATCH] msg_prompt_win: allow automatic window height calculation (by passing height = -1). --- usr.bin/msgc/msg_sys.def | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/usr.bin/msgc/msg_sys.def b/usr.bin/msgc/msg_sys.def index c18d6f1bea60..e00e5cb6df08 100644 --- a/usr.bin/msgc/msg_sys.def +++ b/usr.bin/msgc/msg_sys.def @@ -1,4 +1,4 @@ -/* $NetBSD: msg_sys.def,v 1.43 2019/01/22 18:39:49 martin Exp $ */ +/* $NetBSD: msg_sys.def,v 1.44 2019/03/01 17:02:21 martin Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -490,6 +490,7 @@ msg_prompt_win(msg msg_no, int x, int y, int w, int h, WINDOW *svmsg = NULL, *sv_win = NULL; /* XXX -Wuninitialized [many] */ int maxx, maxy; int msg_flags = MSG_PROMPT_ECHO | MSG_PROMPT_HIDE_DFLT; + const char *np, *ep; maxx = getmaxx(msg_win); maxy = getmaxy(msg_win); @@ -517,6 +518,12 @@ msg_prompt_win(msg msg_no, int x, int y, int w, int h, if (x == -1) x = (maxx - w) / 2 + 1; + if (h < 0) { + h = 3; + for (np = msg_string(msg_no); (ep = strchr(np, '\n')); + np = ep + 1) + h++; + } if (h < 3) h = 3; if (y < 3)