This must be set in the spelling panel and changing language via the spelling panel does not update the buffer (recheck the text with the new spelling language), so toggle automatic spelling after using the spelling panel to change language.
Closes#1139
This was affecting performance when performing actions that go through the entire buffer. Also, none of the functions are involved in any crash reports.
The problem is that we can only return to the proper thread/queue when we know what that thread/queue is. Additionally, when running tests, we are calling from a concurrent queue, so even knowing the queue, we cannot safely update the buffer with the new scopes, as only a serial queue can give us exclusive access.
Presently buffer_t::wait_for_repair will use the grammar from the main thread (rather than wait for the parse thread to finish) which does cause a race condition since the parser will now mutate the grammar (graph coloring).
Ideally buffer_t::wait_for_repeat would simply wait for the parser to finish, but I’d prefer to first switch the parser to use GCD.
If nothing was misspelled in the updated range, and a value existed for the end of the range (indicating that what followed the updated range was misspelled) then that value would be erased.
We invalidate the entire buffer since the word can appear in multiple locations. This could be optimized to only invalidate misspelled instances of the ignored or learned word. Likewise, we redraw entire buffer since the refresh macro is not able to handle changes in spelling meta data and calculate minimal refresh region.
Now using Edit -> Spelling -> Check Spelling selects next spelling error or one
at caret if it was not yet selected, then shows context menu with correction
suggestions.
This makes checking spelling as easy as tapping Cmd+;
Closes#1103
Since parsing is done in a separate thread, and it works with pointers, we need to ensure that the grammar is retained for at least as long as the thread lives.
This is to avoid cyclic dependencies since it was previously in a somewhat high-level framework, so everything that framework depended on, could not augment crash reports.
The first time we ask for the shared spell checker it does some setup involving AppKit (creating the shared spelling panel?). While we already ensure that the spell checker is only called from the main queue, it seems this setup code must run on thread 0, which, when we are not in a Cocoa application, is not necessarily the thread used for the main queue.
Previously this was undefined, yet some code could trigger it. E.g. asking for the OS dictionary pop-up with an empty document.
I wasn’t sure if this should actually be allowed but decided that since operator[] returns strings, the “end of buffer” code point is easily defined as an empty string makes the code using this API simpler.
Unfortunately a printf precision specifier (‘%.*s’) can not come with a width specifier so we have to cast to int. The width specifier ‘t’ is used for ptrdiff_t.
The int → NSInteger change fixed a bug with popup menu positioning, but there was no associated warning or error. It's possible there are more such bugs that we haven't found yet!