tdf#57307 - Expand word boundaries to include connector punctuations

Include connector punctuations when adding a variable to the watch
window using "Enable Watch (F7)" in order to add the correct variable name.

Change-Id: Idaf7699dde3f4147d603c6aea4b2381e2af497a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88575
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Andreas Heinisch
2020-02-12 22:48:45 +01:00
committed by Noel Grandin
parent 7a27ac1060
commit d75781dcd6

View File

@@ -695,14 +695,11 @@ void ModulWindow::BasicAddWatch()
bool bAdd = true;
if ( !GetEditView()->HasSelection() )
{
TextPaM aWordStart;
OUString aWord = GetEditEngine()->GetWord( GetEditView()->GetSelection().GetEnd(), &aWordStart );
// tdf#57307 - expand selection to include connector punctuations
TextSelection aSel;
OUString aWord = GetEditEngine()->GetWord( GetEditView()->GetSelection().GetEnd(), &aSel.GetStart(), &aSel.GetEnd() );
if ( !aWord.isEmpty() )
{
TextSelection aSel( aWordStart );
aSel.GetEnd().GetIndex() += aWord.getLength();
GetEditView()->SetSelection( aSel );
}
else
bAdd = false;
}