summaryrefslogtreecommitdiff
path: root/vcl/source/control/edit.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/control/edit.cxx')
-rw-r--r--vcl/source/control/edit.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index d76b4464ffcf..8cb0a06594fa 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -61,6 +61,7 @@
#include <officecfg/Office/Common.hxx>
+#include <algorithm>
#include <memory>
using namespace ::com::sun::star;
@@ -687,10 +688,14 @@ void Edit::ImplDelete( const Selection& rSelection, sal_uInt8 nDirection, sal_uI
{
i18n::Boundary aBoundary = xBI->getWordBoundary( maText.toString(), aSelection.Min(),
GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES, true );
- if ( aBoundary.startPos == aSelection.Min() )
+ auto startPos = aBoundary.startPos;
+ if ( startPos == aSelection.Min() )
+ {
aBoundary = xBI->previousWord( maText.toString(), aSelection.Min(),
GetSettings().GetLanguageTag().getLocale(), i18n::WordType::ANYWORD_IGNOREWHITESPACES );
- aSelection.Min() = aBoundary.startPos;
+ startPos = std::max(aBoundary.startPos, sal_Int32(0));
+ }
+ aSelection.Min() = startPos;
}
else if ( nMode == EDIT_DELMODE_RESTOFCONTENT )
{