IDEA-128179 Tab title limit: truncation in case of "directory name\file name" tile could be improved

This commit is contained in:
Vassiliy.Kudryashov
2014-08-04 23:02:02 +04:00
parent 8d0b23eacb
commit 348c28f425
3 changed files with 10 additions and 3 deletions
@@ -188,7 +188,7 @@ public class EditorTabsConfigurable implements EditorOptionsProvider {
if (temp.trim().length() > 0) {
try {
int newTabTitleLimit = Integer.parseInt(temp);
newTabTitleLimit = Math.max(10, Math.min(100, newTabTitleLimit));
newTabTitleLimit = Math.max(25, Math.min(100, newTabTitleLimit));
if (newTabTitleLimit != uiSettings.EDITOR_TAB_TITLE_LIMIT){
uiSettings.EDITOR_TAB_TITLE_LIMIT = newTabTitleLimit;
uiSettingsChanged = true;
@@ -2674,12 +2674,19 @@ public class StringUtil extends StringUtilRt {
continue;
}
if (i > 0 && (ch == '/' || ch == '.' || Character.isUpperCase(ch))) {
if (i > 0 && (ch == '/' || ch == '\\' || ch == '.' || Character.isUpperCase(ch))) {
words.add(builder.toString());
builder.delete(0, builder.length());
}
builder.append(ch);
}
for (int i = 0; i < words.size(); i++) {
String word = words.get(i);
if (i < words.size() - 1 && word.length() == 1) {
words.remove(i);
words.set(i, word + words.get(i));
}
}
int removedLength = 0;
@@ -197,7 +197,7 @@ public class StringUtilTest extends TestCase {
}
public void testShortened() {
String[] names = {"AVeryVeeryLongClassName.java", "com.test.SomeJAVAClassName.java", "strangelowercaseclassname.java", "PrefixPostfix.java"};
String[] names = {"AVeryVeeryLongClassName.java", "com.test.SomeJAVAClassName.java", "strangelowercaseclassname.java", "PrefixPostfix.java", "SomeJAVAClassName.java"};
for (String name : names) {
for (int i = name.length() + 1; i > 15; i--) {
String shortened = StringUtil.getShortened(name, i);