From 2ad081660140339ba752ad8f455d0e507444dab4 Mon Sep 17 00:00:00 2001 From: "Vassiliy.Kudryashov" Date: Tue, 5 Aug 2014 15:46:56 +0400 Subject: [PATCH] IDEA-128178 Tab title limit: truncation could be improved --- .../util/src/com/intellij/openapi/util/text/StringUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java index 1a67d9d5a88c..181d660503b8 100644 --- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java +++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java @@ -2696,8 +2696,8 @@ public class StringUtil extends StringUtilRt { index = Math.max(0, (words.size() - 1) / 2); String aWord = words.get(index); words.remove(index); - if (words.size() < 2) { - int toCut = length - removedLength - maxWidth + 3; + int toCut = length - removedLength - maxWidth + 3; + if (words.size() < 2 || (toCut < aWord.length() - 2 && removedLength == 0)) { int pos = (aWord.length() - toCut) / 2; toPaste = aWord.substring(0, pos) + "..." + aWord.substring(pos+toCut); break;