Changeset 18236 in josm for trunk


Ignore:
Timestamp:
2021-09-29T20:27:39+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21375 - exempt <different> from max length restriction (patch by marcello)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/MaxLengthDocumentFilter.java

    r18221 r18236  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.tagging.ac;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46import javax.swing.text.AttributeSet;
     
    1416    /** the document will not accept text longer than this. -1 to disable */
    1517    private int maxLength = -1;
     18    private static final String DIFFERENT = tr("<different>");
    1619
    1720    /**
     
    4245    private boolean mustInsertOrReplace(FilterBypass fb, int length, String string, AttributeSet attr) {
    4346        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) ||
    4548                // allow longer text while composing characters or it will be hard to compose
    4649                // the last characters before the limit
Note: See TracChangeset for help on using the changeset viewer.