X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=form%2Ffld_max.c;h=fc00bc21259a266ce6ef3d3a9f385fb895da34b2;hp=aa68508370cabaa09fa786d590436687aba5dfd6;hb=eccca377f55c70b12e3e92621d94d1e1c1fcfb7d;hpb=b6d0d9ad9e372e856f01a4c283cf784a15993903 diff --git a/form/fld_max.c b/form/fld_max.c index aa685083..fc00bc21 100644 --- a/form/fld_max.c +++ b/form/fld_max.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. * + * Copyright (c) 1998-2013,2019 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 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_max.c,v 1.12 2012/06/10 00:21:24 tom Exp $") +MODULE_ID("$Id: fld_max.c,v 1.14 2019/01/19 21:26:06 Leon.Winter Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -57,13 +57,16 @@ set_max_field(FIELD *field, int maxgrow) if (maxgrow > 0) { - if ((single_line_field && (maxgrow < field->dcols)) || - (!single_line_field && (maxgrow < field->drows))) + if (((single_line_field && (maxgrow < field->dcols)) || + (!single_line_field && (maxgrow < field->drows))) && + !Field_Has_Option(field, O_INPUT_LIMIT)) RETURN(E_BAD_ARGUMENT); } field->maxgrow = maxgrow; + if (Field_Has_Option(field, O_INPUT_LIMIT) && field->dcols > maxgrow) + field->dcols = maxgrow; ClrStatus(field, _MAY_GROW); - if (!(field->opts & O_STATIC)) + if (!((unsigned)field->opts & O_STATIC)) { if ((maxgrow == 0) || (single_line_field && (field->dcols < maxgrow)) ||