From bc965317098708ba18cac810f7e88bdfa1800c5e Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 6 Aug 2007 23:27:42 +0000 Subject: [PATCH] Bug Fix [ 1766180 ] Formatted Field input Bug --- .../src/org/compiere/grid/ed/MDocString.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/client/src/org/compiere/grid/ed/MDocString.java b/client/src/org/compiere/grid/ed/MDocString.java index 50ad084fec..54faf9f70e 100644 --- a/client/src/org/compiere/grid/ed/MDocString.java +++ b/client/src/org/compiere/grid/ed/MDocString.java @@ -131,13 +131,18 @@ public final class MDocString extends PlainDocument implements CaretListener throws BadLocationException { // Max Length - // Begin - fer_luck @ centuryon - // BugFix [ 1766180 ] Formatted Field input Bug - // // @Trifon - [ 1718897 ] User can enter more characters than max size field - // if (getLength() + string.length() > m_maxLength) - if (((String)this.getText().replace(" ", "")).length() + string.length() > m_maxLength) - return; - // End - fer_luck @ centuryon + if (m_VFormat.length() == 0) { + // non formatted strings + // // @Trifon - [ 1718897 ] User can enter more characters than max size field + if (getLength() + string.length() > m_maxLength) + return; + } else { + // Formatted strings + // globalqss - Carlos Ruiz [ 1766180 ] Formatted Field input Bug + if (offset >= m_maxLength) + return; + } + // We have no Format or inserted not manually (assuming correct Format) if (m_VFormat.length() == 0 || string.length() != 1) {