summaryrefslogtreecommitdiffstats
path: root/src/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc
index 666cf9d..70096cd 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -596,6 +596,12 @@ double GetLoadAverage() {
#endif // _WIN32
string ElideMiddle(const string& str, size_t width) {
+ switch (width) {
+ case 0: return "";
+ case 1: return ".";
+ case 2: return "..";
+ case 3: return "...";
+ }
const int kMargin = 3; // Space for "...".
string result = str;
if (result.size() > width) {