From 40a081409d7d16b7fe357cc0b3372af9d8fb8afc Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Sat, 5 Dec 2015 18:55:36 -0600
Subject: [PATCH] queue: Allow room for annotations in truncate width

---
 include/class.queue.php | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/class.queue.php b/include/class.queue.php
index 972bf7c2e..8053f6937 100644
--- a/include/class.queue.php
+++ b/include/class.queue.php
@@ -290,6 +290,13 @@ abstract class QueueColumnAnnotation {
         }
         return $annotations[$root];
     }
+
+    /**
+     * Estimate the width of the rendered annotation in pixels
+     */
+    function getWidth() {
+        return 15;
+    }
 }
 
 class TicketThreadCount
@@ -777,13 +784,18 @@ extends VerySimpleModel {
     }
 
     function applyTruncate($text) {
+        $offset = 0;
+        foreach ($this->getAnnotations() as $a)
+            $offset += $a->getWidth();
+
+        $width = $this->width - $offset;
         switch ($this->truncate) {
         case 'ellipsis':
             return sprintf('<span class="%s" style="max-width:%dpx">%s</span>',
-                'truncate', $this->width*1.1, $text);
+                'truncate', $width, $text);
         case 'clip':
             return sprintf('<span class="%s" style="max-width:%dpx">%s</span>',
-                'truncate clip', $this->width*1.1, $text);
+                'truncate clip', $width, $text);
         default:
         case 'wrap':
             return $text;
-- 
GitLab