[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/source vcl/unx
Justin Luth
justin_luth at sil.org
Thu Jul 2 09:39:40 PDT 2015
sc/source/ui/Accessibility/AccessibleEditObject.cxx | 12 ++++++++++--
vcl/unx/gtk/window/gtksalframe.cxx | 12 ++++++++++--
2 files changed, 20 insertions(+), 4 deletions(-)
New commits:
commit 6f4c31eb757cd19311b23ce06fdbbe9268f9cd16
Author: Justin Luth <justin_luth at sil.org>
Date: Wed Jul 1 07:20:53 2015 +0300
tdf#91641 adjust cursor when deleting preceding characters
IMDeleteSurrounding is used by input methods to take multiple
keystrokes and convert them into a special character. Then the
composing keystrokes are removed.
Before this fix, the cursor placement was not adjusted,
so the special character was inserted in the wrong position
and if 3+ keystrokes were involved, the wrong characters were deleted.
Also fixes "editLine should have focus on accessibleText init."
The first time an accessibleEdit is created, it didnt recognize any
focused text when editing in the "Input Line".
Change-Id: Ib2608c46bba1c84bb49aa29619a004c125a3bf98
Reviewed-on: https://gerrit.libreoffice.org/16637
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
index 0020a70..9910499 100644
--- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx
+++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -372,13 +372,21 @@ void ScAccessibleEditObject::CreateTextHelper()
::std::unique_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(std::move(pAccessibleTextData)));
mpTextHelper = new ::accessibility::AccessibleTextHelper(std::move(pEditSource));
mpTextHelper->SetEventSource(this);
- mpTextHelper->SetFocus(mbHasFocus);
+
+ const ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
+ if ( pInputHdl && pInputHdl->IsEditMode() )
+ {
+ mpTextHelper->SetFocus(true);
+ }
+ else
+ {
+ mpTextHelper->SetFocus(mbHasFocus);
+ }
// #i54814# activate cell in edit mode
if( meObjectType == CellInEditMode )
{
// do not activate cell object, if top edit line is active
- const ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
if( pInputHdl && !pInputHdl->IsTopMode() )
{
SdrHint aHint( HINT_BEGEDIT );
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index 9a2397b..6421c0c 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -4462,7 +4462,7 @@ gboolean GtkSalFrame::IMHandler::signalIMRetrieveSurrounding( GtkIMContext* pCon
uno::Reference<accessibility::XAccessibleEditableText> xText = lcl_GetxText(pFocusWin);
if (xText.is())
{
- sal_uInt32 nPosition = xText->getCaretPosition();
+ sal_Int32 nPosition = xText->getCaretPosition();
OUString sAllText = xText->getText();
OString sUTF = OUStringToOString(sAllText, RTL_TEXTENCODING_UTF8);
OUString sCursorText(sAllText.copy(0, nPosition));
@@ -4484,7 +4484,7 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint
uno::Reference<accessibility::XAccessibleEditableText> xText = lcl_GetxText(pFocusWin);
if (xText.is())
{
- sal_uInt32 nPosition = xText->getCaretPosition();
+ sal_Int32 nPosition = xText->getCaretPosition();
// #i111768# range checking
sal_Int32 nDeletePos = nPosition + offset;
sal_Int32 nDeleteEnd = nDeletePos + nchars;
@@ -4496,6 +4496,14 @@ gboolean GtkSalFrame::IMHandler::signalIMDeleteSurrounding( GtkIMContext*, gint
nDeleteEnd = xText->getCharacterCount();
xText->deleteText(nDeletePos, nDeleteEnd);
+ //tdf91641 adjust cursor if deleted chars shift it forward (normal case)
+ if (nDeletePos < nPosition)
+ {
+ if (nDeleteEnd <= nPosition)
+ xText->setCaretPosition( nPosition-(nDeleteEnd-nDeletePos) );
+ else
+ xText->setCaretPosition( nDeletePos );
+ }
return true;
}
More information about the Libreoffice-commits
mailing list