From 723a86f608879d192347039570e37bd1c04752e1 Mon Sep 17 00:00:00 2001
From: richard <none@none>
Date: Wed, 4 Nov 2009 19:00:40 -0800
Subject: [PATCH] fixed layout of items embedded in notecards

---
 indra/newview/llviewertexteditor.cpp | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 75555efe7a..6f8818be6e 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -188,7 +188,24 @@ public:
 
 	/*virtual*/ S32				getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const 
 	{
-		return 1;
+		// always draw at beginning of line
+		if (line_offset == 0)
+		{
+			return 1;
+		}
+		else
+		{
+			S32 width, height;
+			getDimensions(mStart, 1, width, height);
+			if (width > num_pixels) 
+			{
+				return 0;
+			}
+			else
+			{
+				return 1;
+			}
+		}
 	}
 	/*virtual*/ F32				draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect)
 	{
@@ -208,7 +225,7 @@ public:
 		}
 
 		F32 right_x;
-		mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mBottom, color, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x);
+		mStyle->getFont()->render(mLabel, 0, image_rect.mRight + EMBEDDED_ITEM_LABEL_PADDING, draw_rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::UNDERLINE, LLFontGL::NO_SHADOW, mLabel.length(), S32_MAX, &right_x);
 		return right_x;
 	}
 	
-- 
GitLab