Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/msgc msg_prompt_win: allow automatic window height c...



details:   https://anonhg.NetBSD.org/src/rev/d8ac9293fd63
branches:  trunk
changeset: 449280:d8ac9293fd63
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Mar 01 17:02:21 2019 +0000

description:
msg_prompt_win: allow automatic window height calculation (by passing
height = -1).

diffstat:

 usr.bin/msgc/msg_sys.def |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 388abc53a8f0 -r d8ac9293fd63 usr.bin/msgc/msg_sys.def
--- a/usr.bin/msgc/msg_sys.def  Fri Mar 01 16:42:11 2019 +0000
+++ b/usr.bin/msgc/msg_sys.def  Fri Mar 01 17:02:21 2019 +0000
@@ -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 @@
        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 @@
 
        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)



Home | Main Index | Thread Index | Old Index