From 3640db568d836ef82e2c4d72cbd9bc77126e49bb Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Fri, 20 Apr 2012 11:55:17 +0200 Subject: [PATCH] iterator must return text ranges in proper order (fix renderers in Ctrl+N) --- .../src/com/intellij/psi/codeStyle/NameUtil.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java index 073e65944268..cbfef7d662ad 100644 --- a/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java +++ b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2012 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.List; public class NameUtil { @@ -635,7 +636,18 @@ public class NameUtil { return myPattern.length == 0 ? Collections.emptyList() : null; } - return matchName(name, 0, 0); + final FList ranges = matchName(name, 0, 0); + if (ranges != null) { + final List list = new ArrayList(ranges); + Collections.sort(list, new Comparator() { + @Override + public int compare(TextRange o1, TextRange o2) { + return o1.getStartOffset() - o2.getStartOffset(); + } + }); + return list; + } + return ranges; } } }