Index: FL/fl_ask.H
===================================================================
--- FL/fl_ask.H	(revision 9157)
+++ FL/fl_ask.H	(working copy)
@@ -48,6 +48,8 @@
 FL_EXPORT int fl_choice(const char *q,const char *b0,const char *b1,const char *b2,...) __fl_attr((__format__ (__printf__, 1, 5)));
 FL_EXPORT const char *fl_input(const char *label, const char *deflt = 0, ...) __fl_attr((__format__ (__printf__, 1, 3)));
 FL_EXPORT const char *fl_password(const char *label, const char *deflt = 0, ...) __fl_attr((__format__ (__printf__, 1, 3)));
+FL_EXPORT const char *fl_input_n(const char *label, int maxinput, const char *deflt = 0, ...) __fl_attr((__format__ (__printf__, 1, 4)));
+FL_EXPORT const char *fl_password_n(const char *label, int maxinput, const char *deflt = 0, ...) __fl_attr((__format__ (__printf__, 1, 4)));
 
 FL_EXPORT Fl_Widget *fl_message_icon();
 extern FL_EXPORT Fl_Font fl_message_font_;
Index: FL/Fl_Input_.H
===================================================================
--- FL/Fl_Input_.H	(revision 9157)
+++ FL/Fl_Input_.H	(working copy)
@@ -98,10 +98,16 @@
   /** \internal Buffer memory for expanded text. \see expand() */
   char* buffer;
 
+  /** this basically appears to use buffer for storing input data
+      when the user changes the input, if the value_ is set but
+      not changed then value_ may point to a caller supplied
+      buffer, once changed it's moved to buffer and _value points
+      to buffer */
+
   /** \internal Size of text in bytes in the \p value_ field. */
   int size_;
 
-  /** \internal \todo Please document me! */
+  /** \internal size of buffer */
   int bufsize;
   
   /** \internal Position of the cursor in the document. */
@@ -123,7 +129,7 @@
       of the buffer. */
   int mu_p;
 
-  /** \internal Maximum size of buffer. \todo Is this really needed? */
+  /** \internal Maximum number of chararacters user can input */
   int maximum_size_;
 
   /** \internal Shortcut key that will fetch focus for this widget. */
@@ -261,11 +267,11 @@
   void size(int W, int H) { Fl_Widget::size(W, H); }
 
   /** Gets the maximum length of the input field.  
-    \todo It is not clear if this function is actually required */
+      (the number of characters the user can input)  */
   int maximum_size() const {return maximum_size_;}
 
   /** Sets the maximum length of the input field. 
-    \todo It is not clear if this function is actually required */
+      (the number of characters the user can input)*/
   void maximum_size(int m) {maximum_size_ = m;}
 
   /** Gets the position of the text cursor.
Index: src/fl_ask.cxx
===================================================================
--- src/fl_ask.cxx	(revision 9157)
+++ src/fl_ask.cxx	(working copy)
@@ -420,13 +420,16 @@
 Fl_Widget *fl_message_icon() {makeform(); return icon;}
 
 static const char* input_innards(const char* fmt, va_list ap,
-				 const char* defstr, uchar type) {
+				 const char* defstr, uchar type, int maxinput=0) {
   makeform();
   message->position(60,10);
   input->type(type);
   input->show();
   input->value(defstr);
   input->take_focus();
+  if (maxinput) {
+    input->maximum_size(maxinput);
+  }
 
   int r = innards(fmt, ap, fl_cancel, fl_ok, 0);
   input->hide();
@@ -457,6 +460,22 @@
   return r;
 }
 
+/** version of fl_input that limits the number of characters allowed in input field **/
+const char* fl_input_n(const char *fmt, int maxinput, const char *defstr, ...) {
+
+  if (avoidRecursion) return 0;
+
+  fl_beep(FL_BEEP_QUESTION);
+
+  va_list ap;
+  va_start(ap, defstr);
+  const char* r = input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, maxinput);
+  va_end(ap);
+  return r;
+}
+
+
+
 /** Shows an input dialog displaying the \p fmt message.
 
     Like fl_input() except the input text is not shown,
@@ -483,6 +502,20 @@
   return r;
 }
 
+/** version of fl_password that limits the number of characters allowed in input field **/
+const char *fl_password_n(const char *fmt, int maxinput, const char *defstr, ...) {
+
+  if (avoidRecursion) return 0;
+
+  fl_beep(FL_BEEP_PASSWORD);
+
+  va_list ap;
+  va_start(ap, defstr);
+  const char* r = input_innards(fmt, ap, defstr, FL_SECRET_INPUT, maxinput);
+  va_end(ap);
+  return r;
+}
+
 /** Sets whether or not to move the common message box used in
     many common dialogs like fl_message(), fl_alert(),
     fl_ask(), fl_choice(), fl_input(), fl_password() to follow
Index: src/Fl_Input_.cxx
===================================================================
--- src/Fl_Input_.cxx	(revision 9157)
+++ src/Fl_Input_.cxx	(working copy)
@@ -102,6 +102,10 @@
     }
   }
   *o = 0;
+  // truncate to user requested maximum size
+  if (maximum_size_<MAXBUF) {
+    buf[maximum_size_]=0;
+  }
   return p;
 }
 
@@ -1102,6 +1106,11 @@
   }
   memmove(buffer, value_, size_); buffer[size_] = 0;
   value_ = buffer;
+  // limit to user provied max input
+  if (maximum_size_<size_) {
+    buffer[maximum_size_]=0;
+  }
+
 }
 
 /**
@@ -1148,6 +1157,10 @@
     xscroll_ = yscroll_ = 0;
     minimal_update(0);
   }
+
+  if (size_>maximum_size_) {
+    size_=maximum_size_;
+  }
   position(readonly() ? 0 : size());
   return 1;
 }
