summaryrefslogtreecommitdiff
path: root/gtk2_ardour/utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r--gtk2_ardour/utils.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index dc410136d7..85bb46c6c8 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -122,17 +122,14 @@ fit_to_pixels (cairo_t* cr, std::string name, double avail)
uint32_t width = 0;
while (1) {
- if (name.length() <= 4) {
- break;
- }
-
cairo_text_extents_t ext;
cairo_text_extents (cr, name.c_str(), &ext);
- if (ext.width < avail) {
+
+ if (ext.width < avail || name.length() <= 4) {
width = ext.width;
break;
}
-
+
if (abbreviated) {
name = name.substr (0, name.length() - 4) + "...";
} else {