vcl/unx/gtk/window/gtksalframe.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
New commits: commit 6c76a0a84785b48c29687e6d31b8229a230563d8 Author: Justin Luth <justin_l...@sil.org> Date: Fri May 29 10:10:21 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. Change-Id: I35b97bc150dc68ffe65eebc59450e21e0033bd16 Reviewed-on: https://gerrit.libreoffice.org/15961 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 9f8e35d..7697eca 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -4655,7 +4655,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; @@ -4667,6 +4667,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; }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits