From d81cb42a372941c4e937498c33189575f1115e2c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 2 Feb 2015 18:08:00 -0500 Subject: 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. --- src/util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) + "..." -- cgit v0.12