diff options
| author | Colomban Wendling <ban@herbesfolles.org> | 2019-04-05 14:00:01 +0200 |
|---|---|---|
| committer | Colomban Wendling <ban@herbesfolles.org> | 2019-04-05 14:00:01 +0200 |
| commit | 56792245ec9cd636f56b3dd9e837f12ca8d699e9 (patch) | |
| tree | 9b4faca445aebdae237c3687001287174d7ee496 /gtk/ScintillaGTKAccessible.cxx | |
| parent | ca6ad60c453ecc2a79458c24dc38a1b46d55cf8b (diff) | |
| download | scintilla-mirror-56792245ec9cd636f56b3dd9e837f12ca8d699e9.tar.gz | |
Backport: Bug [#2095]. gtk: Accessible: emit the text deletion signal before deletion
This allows the accessibility layer to request detail, such as which
characters have been deleted. ATK will query the deleted range to
report the data that was removed, so it must still be available for
the query to give a correct answer.
So, emit the signal in BEFOREDELETE instead of DELETETEXT.
Backport of changeset 7406:0a937b4c0b2b.
Diffstat (limited to 'gtk/ScintillaGTKAccessible.cxx')
| -rw-r--r-- | gtk/ScintillaGTKAccessible.cxx | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/gtk/ScintillaGTKAccessible.cxx b/gtk/ScintillaGTKAccessible.cxx index 7e93b8a5e..f9cedcb82 100644 --- a/gtk/ScintillaGTKAccessible.cxx +++ b/gtk/ScintillaGTKAccessible.cxx @@ -160,7 +160,6 @@ ScintillaGTKAccessible *ScintillaGTKAccessible::FromAccessible(GtkAccessible *ac ScintillaGTKAccessible::ScintillaGTKAccessible(GtkAccessible *accessible_, GtkWidget *widget_) : accessible(accessible_), sci(ScintillaGTK::FromWidget(widget_)), - deletionLengthChar(0), old_pos(-1) { SetAccessibility(true); g_signal_connect(widget_, "sci-notify", G_CALLBACK(SciNotify), this); @@ -886,14 +885,11 @@ void ScintillaGTKAccessible::Notify(GtkWidget *, gint, SCNotification *nt) { UpdateCursor(); } if (nt->modificationType & SC_MOD_BEFOREDELETE) { - // We cannot compute the deletion length in DELETETEXT as it requires accessing the - // buffer, so that the character are still present. So, we cache the value here, - // and use it in DELETETEXT that fires quickly after. - deletionLengthChar = sci->pdoc->CountCharacters(nt->position, nt->position + nt->length); + int startChar = CharacterOffsetFromByteOffset(nt->position); + int lengthChar = sci->pdoc->CountCharacters(nt->position, nt->position + nt->length); + g_signal_emit_by_name(accessible, "text-changed::delete", startChar, lengthChar); } if (nt->modificationType & SC_MOD_DELETETEXT) { - int startChar = CharacterOffsetFromByteOffset(nt->position); - g_signal_emit_by_name(accessible, "text-changed::delete", startChar, deletionLengthChar); UpdateCursor(); } if (nt->modificationType & SC_MOD_CHANGESTYLE) { |
