diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-03-26 15:57:46 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-03-26 22:14:30 +0100 |
commit | 8622dc09954a1a26661e3524c99e7ed0f456cf6e (patch) | |
tree | ca98824f5c5a8edf1f27d041a581f4ec099cd6b5 /vcl/source/control/edit.cxx | |
parent | 2f70e6111b61d52bbdfa753257370cb82bfd30eb (diff) |
Related: tdf#123291 treat overwrite like a selection of 1
for input into ImplTruncateToMaxLen like we do for the
following erase
Change-Id: I8cd02ff1ba76f61ddc614922068cbe2bc9bc4cb8
Reviewed-on: https://gerrit.libreoffice.org/69763
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/control/edit.cxx')
-rw-r--r-- | vcl/source/control/edit.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 72325742cac3..a4302902a3c8 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -793,13 +793,19 @@ void Edit::ImplInsertText( const OUString& rStr, const Selection* pNewSel, bool aSelection.Justify(); OUString aNewText( ImplGetValidString( rStr ) ); - ImplTruncateToMaxLen( aNewText, aSelection.Len() ); + + // as below, if there's no selection, but we're in overwrite mode and not beyond + // the end of the existing text then that's like a selection of 1 + auto nSelectionLen = aSelection.Len(); + if (!nSelectionLen && !mbInsertMode && aSelection.Max() < maText.getLength()) + nSelectionLen = 1; + ImplTruncateToMaxLen( aNewText, nSelectionLen ); ImplClearLayoutData(); if ( aSelection.Len() ) maText.remove( static_cast<sal_Int32>(aSelection.Min()), static_cast<sal_Int32>(aSelection.Len()) ); - else if ( !mbInsertMode && (aSelection.Max() < maText.getLength()) ) + else if (!mbInsertMode && aSelection.Max() < maText.getLength()) maText.remove( static_cast<sal_Int32>(aSelection.Max()), 1 ); // take care of input-sequence-checking now |