aboutsummaryrefslogtreecommitdiff
path: root/form/fld_max.c
diff options
context:
space:
mode:
Diffstat (limited to 'form/fld_max.c')
-rw-r--r--form/fld_max.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/form/fld_max.c b/form/fld_max.c
index 6c7fe728bd98..510c3f1c9321 100644
--- a/form/fld_max.c
+++ b/form/fld_max.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2012,2013 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.13 2013/08/24 22:59:28 tom Exp $")
+MODULE_ID("$Id: fld_max.c,v 1.15 2019/01/26 22:18:08 Leon.Winter Exp $")
/*---------------------------------------------------------------------------
| Facility : libnform
@@ -57,11 +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;
+ /* 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))
{