[polari/wip/fmuellner/3-24-1-candidates: 1/10] entryArea: Share a common spell checker
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/3-24-1-candidates: 1/10] entryArea: Share a common spell checker
- Date: Sun, 9 Apr 2017 20:07:07 +0000 (UTC)
commit 5c86ab348e4376190bd9b1e7090618f42e384d7f
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Apr 3 16:02:09 2017 +0200
entryArea: Share a common spell checker
We currently use GSpell's convenience API to add spell checking
support to entries, which turns out to be quite wasteful when
used with lots of separate entries:
Every entry gets a separate GSpellChecker object with its own copy
of the dictionary.
Address this by setting up all entries manually with a shared spell
checker object.
https://bugzilla.gnome.org/show_bug.cgi?id=780762
src/entryArea.js | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/entryArea.js b/src/entryArea.js
index 9e77ecd..1aaca97 100644
--- a/src/entryArea.js
+++ b/src/entryArea.js
@@ -17,6 +17,7 @@ const PasteManager = imports.pasteManager;
const MAX_NICK_UPDATE_TIME = 5; /* s */
const MAX_LINES = 5;
+let _checker = null;
const ChatEntry = new Lang.Class({
Name: 'ChatEntry',
@@ -35,8 +36,14 @@ const ChatEntry = new Lang.Class({
PasteManager.DropTargetIface.addTargets(this, this);
+ if (!_checker)
+ _checker = new Gspell.Checker();
+
+ let buffer = Gspell.EntryBuffer.get_from_gtk_entry_buffer(this.buffer);
+ buffer.set_spell_checker (_checker);
+
let spellEntry = Gspell.Entry.get_from_gtk_entry(this);
- spellEntry.basic_setup();
+ spellEntry.set_inline_spell_checking(true);
this._useDefaultHandler = false;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]