Chromium without the spellchecker on OSX

January 5, 2010

I really, really like the Chrome/Chromium browser, and I’ve become more or less addicted to it. The ability to search directly from the address bar (or whatever it’s called) is a small but extremely useful feature. Also, in my experience it is both faster and less resource hungry than the alternatives, Safari and Firefox.

On Linux and Windows, I use it all the time without problems. But on OSX, one issue has just been too annoying to allow me to use Chrome exclusively: The spellchecker can’t be disabled. The issue it tracked here and here, they just haven’t gotten around to fixing it yet. And since I write a lot of email in Danish, all the red underlining it very distracting (I know that it can be disabled for one text field at a time, but that’s not very cool either).

So I decided to roll a custom build. As you would expect, disabling the spellchecker (permanently) is trivial:

Index: chrome/browser/spellchecker_mac.mm
===================================================================
--- chrome/browser/spellchecker_mac.mm	(revision 35439)
+++ chrome/browser/spellchecker_mac.mm	(working copy)
@@ -145,24 +145,25 @@
 static int last_seen_tag_;
 
 bool CheckSpelling(const string16& word_to_check, int tag) {
-  last_seen_tag_ = tag;
+//   last_seen_tag_ = tag;
 
-  // [[NSSpellChecker sharedSpellChecker] checkSpellingOfString] returns an
-  // NSRange that we can look at to determine if a word is misspelled.
-  NSRange spell_range = {0,0};
+//   // [[NSSpellChecker sharedSpellChecker] checkSpellingOfString] returns an
+//   // NSRange that we can look at to determine if a word is misspelled.
+//   NSRange spell_range = {0,0};
 
-  // Convert the word to an NSString.
-  NSString* NS_word_to_check = base::SysUTF16ToNSString(word_to_check);
-  // Check the spelling, starting at the beginning of the word.
-  spell_range = [[NSSpellChecker sharedSpellChecker]
-                  checkSpellingOfString:NS_word_to_check startingAt:0
-                  language:nil wrap:NO inSpellDocumentWithTag:tag
-                  wordCount:NULL];
+//   // Convert the word to an NSString.
+//   NSString* NS_word_to_check = base::SysUTF16ToNSString(word_to_check);
+//   // Check the spelling, starting at the beginning of the word.
+//   spell_range = [[NSSpellChecker sharedSpellChecker]
+//                   checkSpellingOfString:NS_word_to_check startingAt:0
+//                   language:nil wrap:NO inSpellDocumentWithTag:tag
+//                   wordCount:NULL];
 
   // If the length of the misspelled word == 0,
   // then there is no misspelled word.
-  bool word_correct = (spell_range.length == 0);
-  return word_correct;
+//   bool word_correct = (spell_range.length == 0);
+  // return word_correct;
+  return true;
 }
 
 void FillSuggestionList(const string16& wrong_word,

The diff is a bit messy, but I just commented out the entire body of the CheckSpelling method and replaced it with “return true”. As in “Sure, that word is correct”🙂

If you want it, you can download it from here.

Of course, this means that I now use Chromium instead of Google Chrome, but so far I haven’t noticed any adverse effects from making that switch.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: