diff options
author | Ashod Nakashian <ashodnakashian@yahoo.com> | 2015-07-08 08:37:23 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-06 12:55:55 +0200 |
commit | ebbee8498c92308cca4147bd6c236190c3f83b68 (patch) | |
tree | 0c6d3e5e5713d404cc5dc02d9d5ff07e98b06085 /svx | |
parent | 5603cdb54ac53bb76e72b7c8a950ce3dca135eb0 (diff) |
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 <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit c3c6bf235af32781e83d4fed2867a16bfeafa659)
Signed-off-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/fntctrl.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 2767bb79b02f..2fce458c0a13 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)); } } |