Changeset 18192 in josm
- Timestamp:
- 2021-09-03T02:11:51+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompComboBox.java
r18173 r18192 105 105 public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr) 106 106 throws BadLocationException { 107 int newLen = fb.getDocument().getLength() + string.length(); 108 if (maxTextLength == -1 || newLen <= maxTextLength || 109 // allow longer text while composing characters or it will be hard to compose 110 // the last characters before the limit 111 ((attr != null) && attr.isDefined(StyleConstants.ComposedTextAttribute))) { 107 if (mustInsertOrReplace(fb, 0, string, attr)) { 112 108 super.insertString(fb, offset, string, attr); 113 109 } … … 117 113 public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr) 118 114 throws BadLocationException { 119 int newLen = fb.getDocument().getLength() - length + string.length(); 120 if (maxTextLength == -1 || newLen <= maxTextLength || 115 if (mustInsertOrReplace(fb, length, string, attr)) { 116 super.replace(fb, offset, length, string, attr); 117 } 118 } 119 120 private boolean mustInsertOrReplace(FilterBypass fb, int length, String string, AttributeSet attr) { 121 int newLen = fb.getDocument().getLength() - length + ((string == null) ? 0 : string.length()); 122 return (maxTextLength == -1 || newLen <= maxTextLength || 121 123 // allow longer text while composing characters or it will be hard to compose 122 124 // the last characters before the limit 123 ((attr != null) && attr.isDefined(StyleConstants.ComposedTextAttribute))) { 124 super.replace(fb, offset, length, string, attr); 125 } 125 ((attr != null) && attr.isDefined(StyleConstants.ComposedTextAttribute))); 126 126 } 127 127 }
Note:
See TracChangeset
for help on using the changeset viewer.