From 06f4ef5bdd96fc9828812dacb2b38f3317553035 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 4 May 2017 21:46:52 +0200 Subject: [PATCH] RUBY-19535 Search Everywhere is not useful when searching methods --- .../ide/actions/SearchEverywherePsiRenderer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywherePsiRenderer.java b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywherePsiRenderer.java index f6bfeb959d96..a276e274cd61 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywherePsiRenderer.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SearchEverywherePsiRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2017 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. @@ -119,14 +119,15 @@ class SearchEverywherePsiRenderer extends PsiElementListCellRenderer String right = ")"; if (fm.stringWidth(left + text + right) < maxWidth) return left + text + right; - final LinkedList parts = new LinkedList<>(StringUtil.split(text, ".")); + String separator = text.contains(File.separator) ? File.separator : "."; + final LinkedList parts = new LinkedList<>(StringUtil.split(text, separator)); int index; while (parts.size() > 1) { index = parts.size() / 2 - 1; parts.remove(index); - if (fm.stringWidth(StringUtil.join(parts, ".") + "...") < maxWidth) { - parts.add(index, index == 0 ? "..." : "."); - return left + StringUtil.join(parts, ".") + right; + if (fm.stringWidth(StringUtil.join(parts, separator) + "...") < maxWidth) { + parts.add(index, "..."); + return left + StringUtil.join(parts, separator) + right; } } //todo