svx/source/dialog/fntctrl.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit c3c6bf235af32781e83d4fed2867a16bfeafa659
Author: Ashod Nakashian <ashodnakash...@yahoo.com>
Date:   Wed Jul 8 08:37:23 2015 -0400

    Limit the font preview text length.
    
    When text is selected, the preview text is the first TEXT_WIDTH (80)
    characters of the selection rounded up to the next word.
    
    However when no word boundary is found, the preview text is as long
    as the selection, which causes the preview to be less than usable
    in some extreme cases.
    
    This patch is to limit the preview text length when no word boundary
    is found, thereby always resulting in predictable behavior.
    
    Change-Id: I8a21638d601714db956b9b160664dfe1e5e49a4a
    Reviewed-on: https://gerrit.libreoffice.org/16855
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 2767bb7..2fce458 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -712,9 +712,11 @@ void SvxFontPrevWindow::Paint(vcl::RenderContext& 
rRenderContext, const Rectangl
 
             if (pImpl->maText.getLength() > (TEXT_WIDTH - 1))
             {
-                sal_Int32 nSpaceIdx = pImpl->maText.indexOf(" ", TEXT_WIDTH);
+                const sal_Int32 nSpaceIdx = pImpl->maText.indexOf(" ", 
TEXT_WIDTH);
                 if (nSpaceIdx != -1)
                     pImpl->maText = pImpl->maText.copy(0, nSpaceIdx);
+                else
+                    pImpl->maText = pImpl->maText.copy(0, (TEXT_WIDTH - 1));
             }
         }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to