From b5bd47c636e9b8dc33ca757e9c5d9bea7e5839c7 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 31 Mar 2011 15:27:09 +0200 Subject: [PATCH] fix python test: if a prefix starts with an underscore, don't allow variants to start with more underscores --- .../com/intellij/psi/codeStyle/NameUtil.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java index c6b1218acdaf..5882dd07e66f 100644 --- a/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java +++ b/platform/util/src/com/intellij/psi/codeStyle/NameUtil.java @@ -509,22 +509,26 @@ public class NameUtil { return handleAsterisk(patternIndex, words, wordIndex); } + if (patternIndex == 0 && myFirstLetterCaseMatters && word.charAt(0) != myPattern[0]) { + return false; + } + if (isWordSeparator(word.charAt(0))) { assert word.length() == 1 : "'" + word + "'"; - if (isWordSeparator(myPattern[patternIndex])) { + char p = myPattern[patternIndex]; + if (isWordSeparator(p)) { + if (myFirstLetterCaseMatters && + wordIndex == 0 && words.size() > 1 && patternIndex + 1 < myPattern.length && + isWordSeparator(words.get(1).charAt(0)) && !isWordSeparator(myPattern[patternIndex + 1])) { + return false; + } + return matches(patternIndex + 1, words, wordIndex + 1); } - if (patternIndex == 0 && myFirstLetterCaseMatters) { - return false; - } return matches(patternIndex, words, wordIndex + 1); } - if (patternIndex == 0 && myFirstLetterCaseMatters && word.charAt(0) != myPattern[0]) { - return false; - } - if (StringUtil.toLowerCase(word.charAt(0)) != StringUtil.toLowerCase(myPattern[patternIndex])) { return false; }