[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Mar 2 07:09:04 PST 2015
sw/source/core/crsr/swcrsr.cxx | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit cd7c33e31fac9906d4246cdcb4de348348226685
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Mar 2 15:49:15 2015 +0100
SwCursor: when tiled rendering also select word before the point
On the desktop, the logic is that if we double-click before a word, then we
select the word, but if we double-click after it, then we don't.
When tiled rendering, it's more important to always select something, as
that's how the selection can be adjusted further. So if we long push
after a non-empty text node, then select its last word. This way
something is always selected if e.g. the user long pushes inside a table
cell. (If the table cell is empty, then that's handled in
SwCrsrShell::SelectCell().)
Change-Id: I6e84874b8cf252fc6b72a75ffe9db67b03636862
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index ff3ee93..94a7216 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1366,13 +1366,24 @@ bool SwCursor::SelectWordWT( SwViewShell* pViewShell, sal_Int16 nWordType, const
}
else
{
- const sal_Int32 nPtPos = GetPoint()->nContent.GetIndex();
+ sal_Int32 nPtPos = GetPoint()->nContent.GetIndex();
Boundary aBndry( g_pBreakIt->GetBreakIter()->getWordBoundary(
pTxtNd->GetTxt(), nPtPos,
g_pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
nWordType,
bForward ));
+ if (pViewShell->isTiledRendering() && aBndry.startPos == aBndry.endPos && nPtPos > 0)
+ {
+ // nPtPos is the end of the paragraph, select the last word then.
+ --nPtPos;
+ aBndry = Boundary( g_pBreakIt->GetBreakIter()->getWordBoundary(
+ pTxtNd->GetTxt(), nPtPos,
+ g_pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
+ nWordType,
+ bForward ));
+ }
+
if( aBndry.startPos != aBndry.endPos )
{
GetPoint()->nContent = aBndry.endPos;
More information about the Libreoffice-commits
mailing list