Ticket #18964: 18964.patch
| File 18964.patch, 2.4 KB (added by , 6 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java
447 447 public static class IndexCondition implements Condition { 448 448 final String index; 449 449 final Op op; 450 final boolean isFirstOrLast; 450 451 451 452 /** 452 453 * Constructs a new {@code IndexCondition}. … … 456 457 public IndexCondition(String index, Op op) { 457 458 this.index = index; 458 459 this.op = op; 460 isFirstOrLast = op == Op.EQ && ("1".equals(index) || "-1".equals(index)); 459 461 } 460 462 461 463 @Override -
src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
34 34 import org.openstreetmap.josm.data.validation.tests.CrossingWays; 35 35 import org.openstreetmap.josm.gui.mappaint.Environment; 36 36 import org.openstreetmap.josm.gui.mappaint.Range; 37 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.IndexCondition; 37 38 import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.OpenEndPseudoClassCondition; 38 39 import org.openstreetmap.josm.tools.CheckParameterUtil; 39 40 import org.openstreetmap.josm.tools.CompositeList; … … 219 220 e.count = count; 220 221 return; 221 222 } 222 for (int i = 0; i < count; i++) { 223 // see #18964 224 boolean firstAndLastOnly = true; 225 for (Condition c : link.conds) { 226 if (!(c instanceof IndexCondition) || !((IndexCondition) c).isFirstOrLast) { 227 firstAndLastOnly = false; 228 break; 229 } 230 } 231 int step = firstAndLastOnly ? count - 1 : 1; 232 233 for (int i = 0; i < count; i += step) { 223 234 if (getter.apply(i).equals(e.osm) && link.matches(e.withParentAndIndexAndLinkContext(parent, i, count))) { 224 235 e.parent = parent; 225 236 e.index = i;
