aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColomban Wendling <ban@herbesfolles.org>2019-04-05 14:00:01 +0200
committerColomban Wendling <ban@herbesfolles.org>2019-04-05 14:00:01 +0200
commit8b500683bdd32d6e1533909508a641aa83f2f473 (patch)
tree64b4b4821606c1f6f9b82f72e41d929921e03a48
parent5f23a0f3f64fb575e0aaebe2a309518909db44c8 (diff)
downloadscintilla-mirror-8b500683bdd32d6e1533909508a641aa83f2f473.tar.gz
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.
-rw-r--r--doc/ScintillaHistory.html4
-rw-r--r--gtk/ScintillaGTKAccessible.cxx10
-rw-r--r--gtk/ScintillaGTKAccessible.h2
3 files changed, 7 insertions, 9 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 198ffba68..7d7ef53d5 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -581,6 +581,10 @@
<a href="https://sourceforge.net/p/scintilla/bugs/2094/">Bug #2094</a>.
</li>
<li>
+ Fix text reported for deletion with accessibility on GTK.
+ <a href="https://sourceforge.net/p/scintilla/bugs/2095/">Bug #2095</a>.
+ </li>
+ <li>
Fix flicker when inserting primary selection on GTK.
<a href="https://sourceforge.net/p/scintilla/bugs/2087/">Bug #2087</a>.
</li>
diff --git a/gtk/ScintillaGTKAccessible.cxx b/gtk/ScintillaGTKAccessible.cxx
index 714fde10d..3cea1573c 100644
--- a/gtk/ScintillaGTKAccessible.cxx
+++ b/gtk/ScintillaGTKAccessible.cxx
@@ -161,7 +161,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);
@@ -887,14 +886,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) {
diff --git a/gtk/ScintillaGTKAccessible.h b/gtk/ScintillaGTKAccessible.h
index 00570acce..b9d94b0e2 100644
--- a/gtk/ScintillaGTKAccessible.h
+++ b/gtk/ScintillaGTKAccessible.h
@@ -18,8 +18,6 @@ private:
GtkAccessible *accessible;
ScintillaGTK *sci;
- // cached length of the deletion, in characters (see Notify())
- int deletionLengthChar;
// local state for comparing
Sci::Position old_pos;
std::vector<SelectionRange> old_sels;