X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffld_max.c;h=7d0e146d9191a4a0fd9f89026b5825236dfb9dc4;hp=fc00bc21259a266ce6ef3d3a9f385fb895da34b2;hb=47d2fb4537d9ad5bb14f4810561a327930ca4280;hpb=eccca377f55c70b12e3e92621d94d1e1c1fcfb7d diff --git a/form/fld_max.c b/form/fld_max.c index fc00bc21..7d0e146d 100644 --- a/form/fld_max.c +++ b/form/fld_max.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2019 Free Software Foundation, Inc. * + * Copyright 2019,2020 Thomas E. Dickey * + * Copyright 1998-2012,2013 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +33,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_max.c,v 1.14 2019/01/19 21:26:06 Leon.Winter Exp $") +MODULE_ID("$Id: fld_max.c,v 1.16 2020/02/02 23:34:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -63,7 +64,9 @@ set_max_field(FIELD *field, int maxgrow) RETURN(E_BAD_ARGUMENT); } field->maxgrow = maxgrow; - if (Field_Has_Option(field, O_INPUT_LIMIT) && field->dcols > maxgrow) + /* shrink */ + if (maxgrow > 0 && Field_Has_Option(field, O_INPUT_LIMIT) && + field->dcols > maxgrow) field->dcols = maxgrow; ClrStatus(field, _MAY_GROW); if (!((unsigned)field->opts & O_STATIC))