aboutsummaryrefslogtreecommitdiff
path: root/git-gui/git-gui.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-13 11:04:58 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-13 11:04:58 -0800
commit41e2edf41a6d501f1b8beca7f1f0bcbe9296dcc2 (patch)
tree5a3e97b7c147242f3550a7318ec45480ecaa7480 /git-gui/git-gui.sh
parent6bc4c72132adbdc06c428f86a96f27e4f8173b99 (diff)
parent95b002eeb38de89feb7f0cc1a55721b45fd3cf11 (diff)
downloadgit-41e2edf41a6d501f1b8beca7f1f0bcbe9296dcc2.tar.gz
git-41e2edf41a6d501f1b8beca7f1f0bcbe9296dcc2.tar.xz
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: git-gui: Automatically spell check commit messages as the user types git-gui: support Git Gui.app under OS X 10.5 git-gui: Update German translation. git-gui: (i18n) Fix a bunch of still untranslated strings.
Diffstat (limited to 'git-gui/git-gui.sh')
-rwxr-xr-xgit-gui/git-gui.sh34
1 files changed, 33 insertions, 1 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index f42e461fd..5d65272e2 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -612,6 +612,7 @@ set default_config(gui.pruneduringfetch) false
set default_config(gui.trustmtime) false
set default_config(gui.diffcontext) 5
set default_config(gui.newbranchtemplate) {}
+set default_config(gui.spellingdictionary) {}
set default_config(gui.fontui) [font configure font_ui]
set default_config(gui.fontdiff) [font configure font_diff]
set font_descs {
@@ -1683,6 +1684,7 @@ set is_quitting 0
proc do_quit {} {
global ui_comm is_quitting repo_config commit_type
global GITGUI_BCK_exists GITGUI_BCK_i
+ global ui_comm_spell
if {$is_quitting} return
set is_quitting 1
@@ -1710,6 +1712,12 @@ proc do_quit {} {
}
}
+ # -- Cancel our spellchecker if its running.
+ #
+ if {[info exists ui_comm_spell]} {
+ $ui_comm_spell stop
+ }
+
# -- Remove our editor backup, its not needed.
#
after cancel $GITGUI_BCK_i
@@ -2454,7 +2462,7 @@ $ctxm add separator
$ctxm add command \
-label [mc "Sign Off"] \
-command do_signoff
-bind_button3 $ui_comm "tk_popup $ctxm %X %Y"
+set ui_comm_ctxm $ctxm
# -- Diff Header
#
@@ -2857,6 +2865,30 @@ if {[winfo exists $ui_comm]} {
}
backup_commit_buffer
+
+ # -- If the user has aspell available we can drive it
+ # in pipe mode to spellcheck the commit message.
+ #
+ set spell_cmd [list |]
+ set spell_dict [get_config gui.spellingdictionary]
+ lappend spell_cmd aspell
+ if {$spell_dict ne {}} {
+ lappend spell_cmd --master=$spell_dict
+ }
+ lappend spell_cmd --mode=none
+ lappend spell_cmd --encoding=utf-8
+ lappend spell_cmd pipe
+ if {$spell_dict eq {none}
+ || [catch {set spell_fd [open $spell_cmd r+]} spell_err]} {
+ bind_button3 $ui_comm [list tk_popup $ui_comm_ctxm %X %Y]
+ } else {
+ set ui_comm_spell [spellcheck::init \
+ $spell_fd \
+ $ui_comm \
+ $ui_comm_ctxm \
+ ]
+ }
+ unset -nocomplain spell_cmd spell_fd spell_err spell_dict
}
lock_index begin-read