summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@gmail.com>2015-02-02 23:08:00 (GMT)
committerBen Boeckel <mathstuf@gmail.com>2018-11-09 15:47:27 (GMT)
commitd81cb42a372941c4e937498c33189575f1115e2c (patch)
treeb21c5b37afbec0d948fd5ff85dd857246c21a030
parent99c5c2287b11c8bab05fb2a8cf89dc4856c708bc (diff)
downloadNinja-d81cb42a372941c4e937498c33189575f1115e2c.zip
Ninja-d81cb42a372941c4e937498c33189575f1115e2c.tar.gz
Ninja-d81cb42a372941c4e937498c33189575f1115e2c.tar.bz2
util: don't add ellipses width when deciding if they're necessary
If the string fits, just use it. If we need the ellipses, *then* we need to compute the width based on that.
-rw-r--r--src/util.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util.cc b/src/util.cc
index 760bc23..7bfe033 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -573,7 +573,7 @@ double GetLoadAverage() {
string ElideMiddle(const string& str, size_t width) {
const int kMargin = 3; // Space for "...".
string result = str;
- if (result.size() + kMargin > width) {
+ if (result.size() > width) {
size_t elide_size = (width - kMargin) / 2;
result = result.substr(0, elide_size)
+ "..."