Kaydet (Commit) 8622dc09 authored tarafından Caolán McNamara's avatar Caolán McNamara

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: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 2f70e611
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment