From 38bd897de5460120ebf57b2454c1d2755b5c6991 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Sat, 23 Apr 2016 19:58:04 -0500
Subject: [PATCH] queue: oops: Fix ending punctuation for 'clip beginning' mode

---
 include/class.queue.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/class.queue.php b/include/class.queue.php
index 0dab778b6..be5ca24ef 100644
--- a/include/class.queue.php
+++ b/include/class.queue.php
@@ -1497,7 +1497,12 @@ extends VerySimpleModel {
         switch ($this->truncate) {
         case 'lclip':
             $linfo = Internationalization::getCurrentLanguageInfo();
-            $class[] = $linfo['direction'] == 'rtl' ? 'ltr' : 'rtl';
+            // Use `rtl` class to cut the beginning of LTR text. But, wrap
+            // the text with an appropriate direction so the ending
+            // punctuation is not rearranged.
+            $dir = $linfo['direction'] ?: 'ltr';
+            $text = sprintf('<span class="%s">%s</span>', $dir, $text);
+            $class[] = $dir == 'rtl' ? 'ltr' : 'rtl';
         case 'clip':
             $class[] = 'bleed';
         case 'ellipsis':
-- 
GitLab