- Timestamp:
- 2021-09-29T20:27:39+02:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/ac/MaxLengthDocumentFilter.java
r18221 r18236 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.tagging.ac; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import javax.swing.text.AttributeSet; … … 14 16 /** the document will not accept text longer than this. -1 to disable */ 15 17 private int maxLength = -1; 18 private static final String DIFFERENT = tr("<different>"); 16 19 17 20 /** … … 42 45 private boolean mustInsertOrReplace(FilterBypass fb, int length, String string, AttributeSet attr) { 43 46 int newLen = fb.getDocument().getLength() - length + ((string == null) ? 0 : string.length()); 44 return (maxLength == -1 || newLen <= maxLength || 47 return (maxLength == -1 || newLen <= maxLength || DIFFERENT.equals(string) || 45 48 // allow longer text while composing characters or it will be hard to compose 46 49 // the last characters before the limit
Note:
See TracChangeset
for help on using the changeset viewer.