Adam Flott <adam@xxxxxxxx> wrote: > The other day I committed something with a comment that had a rather > embarrassing misspelling. I had some more commits on top of that and I > was about to dcommit it up to the companies SVN repository before I > caught it. I reset the commits to fix it and all was well. > > But it had me thinking about avoiding the problem in the future and how > I handle it in other applications. So far, I think Opera has the best > GUI spell checking[1]. I then went and poked around the git-gui code to > see how hard it would be to learn some minimal Tk in order to implement > such a thing. > > [1]: http://npjh.com/etc/opera-spell-check.png > > If Tk comes really natural and you could crank this sort of thing out > and have the time to do so, I would really appreciate it. Otherwise I > might take a stab at it. Reading the aspell documentation (what Opera) > uses doesn't seem all that bad about operating with stdout/stdin. I > browsed the web looking for "recipes" for making something very similar > to the Opera spell checker, but I don't think I found any good resources > which explain going from little Tcl/Tk to a workable simple GUI. > > Is this some functionality you and/or others would like to see? I've been thinking about adding some sort of spell checking to git-gui. One of the things I liked about Mozilla's XUL implementation is that you can perform spell checking on any input field "for free" by just asking for it. Tk hasn't caught up to that level of functionality. :-\ I would personally prefer the more complex solution that a lot of tools do these days, which is to underline the misspelled words in red and let the user correct the word by right clicking on it. Mozilla does this for textareas in HTML (based upon that XUL widget), Outlook does it on Windows, Microsoft Word does it, and a number of Mac OS X applications implement it. The ispell/aspell pipe protocol should make this rather easy: - Open a bidirectional pipe to aspell on startup; - Set it into terse mode; - Use a UTF-8 encoding. - On idle if the commit message area is dirty we already save it to a backup file (in case of random Tk crashes). - Feed the text to aspell and remember the lines we sent. - When we get the results back, if the line still matches what is in the Tk widget add a 'mispelled' tag to the mispelled words. Such lines haven't been edited by the user since we submitted it to aspell. - Setup a right-click binding on the 'mispelled' tag to show a popup menu. Populate the menu with the suggestions from aspell. I'm thinking its easier to re-ask aspell for suggestions then it would be to keep track of the suggestions we received when we asked for the mispelling detection. -- Shawn. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html