aboutsummaryrefslogtreecommitdiffhomepage
path: root/gtk/ScintillaGTKAccessible.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/ScintillaGTKAccessible.cxx')
-rw-r--r--gtk/ScintillaGTKAccessible.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/gtk/ScintillaGTKAccessible.cxx b/gtk/ScintillaGTKAccessible.cxx
index 5f2979894..714fde10d 100644
--- a/gtk/ScintillaGTKAccessible.cxx
+++ b/gtk/ScintillaGTKAccessible.cxx
@@ -163,6 +163,7 @@ ScintillaGTKAccessible::ScintillaGTKAccessible(GtkAccessible *accessible_, GtkWi
sci(ScintillaGTK::FromWidget(widget_)),
deletionLengthChar(0),
old_pos(-1) {
+ SetAccessibility(true);
g_signal_connect(widget_, "sci-notify", G_CALLBACK(SciNotify), this);
}
@@ -866,10 +867,12 @@ void ScintillaGTKAccessible::NotifyReadOnly() {
#endif
}
-void ScintillaGTKAccessible::SetAccessibility() {
+void ScintillaGTKAccessible::SetAccessibility(bool enabled) {
// Called by ScintillaGTK when application has enabled or disabled accessibility
- character_offsets.resize(0);
- character_offsets.push_back(0);
+ if (enabled)
+ sci->pdoc->AllocateLineCharacterIndex(SC_LINECHARACTERINDEX_UTF32);
+ else
+ sci->pdoc->ReleaseLineCharacterIndex(SC_LINECHARACTERINDEX_UTF32);
}
void ScintillaGTKAccessible::Notify(GtkWidget *, gint, SCNotification *nt) {
@@ -877,13 +880,6 @@ void ScintillaGTKAccessible::Notify(GtkWidget *, gint, SCNotification *nt) {
return;
switch (nt->nmhdr.code) {
case SCN_MODIFIED: {
- if (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) {
- // invalidate character offset cache if applicable
- const Sci::Line line = sci->pdoc->LineFromPosition(nt->position);
- if (character_offsets.size() > static_cast<size_t>(line + 1)) {
- character_offsets.resize(line + 1);
- }
- }
if (nt->modificationType & SC_MOD_INSERTTEXT) {
int startChar = CharacterOffsetFromByteOffset(nt->position);
int lengthChar = sci->pdoc->CountCharacters(nt->position, nt->position + nt->length);