Compare commits
38 Commits
v1.5.4.5
...
gitgui-0.1
Author | SHA1 | Date | |
---|---|---|---|
3d654be48f | |||
c91ee2bd61 | |||
739a6d4970 | |||
477ef326a3 | |||
02a8b27645 | |||
45e53d17ee | |||
442b3caaee | |||
427f48603e | |||
b79f5ffc9b | |||
4f994937c8 | |||
9065c36ea3 | |||
0212242d66 | |||
48ed49f2eb | |||
0c87a951c2 | |||
7276607886 | |||
11027d544b | |||
c382fdd795 | |||
312fd92b06 | |||
f15b75855f | |||
f49b6c10b7 | |||
b5e2f805e6 | |||
afdb4be0fc | |||
bb760f0257 | |||
827743b2e8 | |||
de83f8cc4c | |||
35d04b3b11 | |||
dd0962883b | |||
f57ca1efe5 | |||
f4d93486ae | |||
cec8f51bd6 | |||
c548f86273 | |||
b8331e1567 | |||
740b9b9ff4 | |||
765239e9d2 | |||
95b002eeb3 | |||
88965d198f | |||
5f09a37bbb | |||
5e6d7768e1 |
@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
GVF=GIT-VERSION-FILE
|
GVF=GIT-VERSION-FILE
|
||||||
DEF_VER=0.9.GITGUI
|
DEF_VER=0.10.GITGUI
|
||||||
|
|
||||||
LF='
|
LF='
|
||||||
'
|
'
|
||||||
|
7
Makefile
7
Makefile
@ -221,14 +221,9 @@ ifdef NO_MSGFMT
|
|||||||
MSGFMT ?= $(TCL_PATH) po/po2msg.sh
|
MSGFMT ?= $(TCL_PATH) po/po2msg.sh
|
||||||
else
|
else
|
||||||
MSGFMT ?= msgfmt
|
MSGFMT ?= msgfmt
|
||||||
ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
|
ifneq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null; echo $$?),0)
|
||||||
MSGFMT := $(TCL_PATH) po/po2msg.sh
|
MSGFMT := $(TCL_PATH) po/po2msg.sh
|
||||||
endif
|
endif
|
||||||
ifeq (msgfmt,$(MSGFMT))
|
|
||||||
ifeq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null || echo $?),1)
|
|
||||||
MSGFMT := $(TCL_PATH) po/po2msg.sh
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
msgsdir = $(gg_libdir)/msgs
|
msgsdir = $(gg_libdir)/msgs
|
||||||
|
98
git-gui.sh
98
git-gui.sh
@ -611,7 +611,9 @@ set default_config(gui.matchtrackingbranch) false
|
|||||||
set default_config(gui.pruneduringfetch) false
|
set default_config(gui.pruneduringfetch) false
|
||||||
set default_config(gui.trustmtime) false
|
set default_config(gui.trustmtime) false
|
||||||
set default_config(gui.diffcontext) 5
|
set default_config(gui.diffcontext) 5
|
||||||
|
set default_config(gui.commitmsgwidth) 75
|
||||||
set default_config(gui.newbranchtemplate) {}
|
set default_config(gui.newbranchtemplate) {}
|
||||||
|
set default_config(gui.spellingdictionary) {}
|
||||||
set default_config(gui.fontui) [font configure font_ui]
|
set default_config(gui.fontui) [font configure font_ui]
|
||||||
set default_config(gui.fontdiff) [font configure font_diff]
|
set default_config(gui.fontdiff) [font configure font_diff]
|
||||||
set font_descs {
|
set font_descs {
|
||||||
@ -1683,6 +1685,7 @@ set is_quitting 0
|
|||||||
proc do_quit {} {
|
proc do_quit {} {
|
||||||
global ui_comm is_quitting repo_config commit_type
|
global ui_comm is_quitting repo_config commit_type
|
||||||
global GITGUI_BCK_exists GITGUI_BCK_i
|
global GITGUI_BCK_exists GITGUI_BCK_i
|
||||||
|
global ui_comm_spell
|
||||||
|
|
||||||
if {$is_quitting} return
|
if {$is_quitting} return
|
||||||
set is_quitting 1
|
set is_quitting 1
|
||||||
@ -1710,6 +1713,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.
|
# -- Remove our editor backup, its not needed.
|
||||||
#
|
#
|
||||||
after cancel $GITGUI_BCK_i
|
after cancel $GITGUI_BCK_i
|
||||||
@ -1837,6 +1846,22 @@ proc add_range_to_selection {w x y} {
|
|||||||
$w tag add in_sel $begin.0 [expr {$end + 1}].0
|
$w tag add in_sel $begin.0 [expr {$end + 1}].0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc show_more_context {} {
|
||||||
|
global repo_config
|
||||||
|
if {$repo_config(gui.diffcontext) < 99} {
|
||||||
|
incr repo_config(gui.diffcontext)
|
||||||
|
reshow_diff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc show_less_context {} {
|
||||||
|
global repo_config
|
||||||
|
if {$repo_config(gui.diffcontext) >= 1} {
|
||||||
|
incr repo_config(gui.diffcontext) -1
|
||||||
|
reshow_diff
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
##
|
##
|
||||||
## ui construction
|
## ui construction
|
||||||
@ -2037,6 +2062,16 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
|
|||||||
|
|
||||||
.mbar.commit add separator
|
.mbar.commit add separator
|
||||||
|
|
||||||
|
.mbar.commit add command -label [mc "Show Less Context"] \
|
||||||
|
-command show_less_context \
|
||||||
|
-accelerator $M1T-\[
|
||||||
|
|
||||||
|
.mbar.commit add command -label [mc "Show More Context"] \
|
||||||
|
-command show_more_context \
|
||||||
|
-accelerator $M1T-\]
|
||||||
|
|
||||||
|
.mbar.commit add separator
|
||||||
|
|
||||||
.mbar.commit add command -label [mc "Sign Off"] \
|
.mbar.commit add command -label [mc "Sign Off"] \
|
||||||
-command do_signoff \
|
-command do_signoff \
|
||||||
-accelerator $M1T-S
|
-accelerator $M1T-S
|
||||||
@ -2080,7 +2115,7 @@ if {[is_enabled transport]} {
|
|||||||
if {[is_MacOSX]} {
|
if {[is_MacOSX]} {
|
||||||
# -- Apple Menu (Mac OS X only)
|
# -- Apple Menu (Mac OS X only)
|
||||||
#
|
#
|
||||||
.mbar add cascade -label [mc Apple] -menu .mbar.apple
|
.mbar add cascade -label Apple -menu .mbar.apple
|
||||||
menu .mbar.apple
|
menu .mbar.apple
|
||||||
|
|
||||||
.mbar.apple add command -label [mc "About %s" [appname]] \
|
.mbar.apple add command -label [mc "About %s" [appname]] \
|
||||||
@ -2281,8 +2316,9 @@ pack .vpane -anchor n -side top -fill both -expand 1
|
|||||||
#
|
#
|
||||||
frame .vpane.files.index -height 100 -width 200
|
frame .vpane.files.index -height 100 -width 200
|
||||||
label .vpane.files.index.title -text [mc "Staged Changes (Will Commit)"] \
|
label .vpane.files.index.title -text [mc "Staged Changes (Will Commit)"] \
|
||||||
-background lightgreen
|
-background lightgreen -foreground black
|
||||||
text $ui_index -background white -borderwidth 0 \
|
text $ui_index -background white -foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-width 20 -height 10 \
|
-width 20 -height 10 \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
-cursor $cursor_ptr \
|
-cursor $cursor_ptr \
|
||||||
@ -2300,8 +2336,9 @@ pack $ui_index -side left -fill both -expand 1
|
|||||||
#
|
#
|
||||||
frame .vpane.files.workdir -height 100 -width 200
|
frame .vpane.files.workdir -height 100 -width 200
|
||||||
label .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
|
label .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
|
||||||
-background lightsalmon
|
-background lightsalmon -foreground black
|
||||||
text $ui_workdir -background white -borderwidth 0 \
|
text $ui_workdir -background white -foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-width 20 -height 10 \
|
-width 20 -height 10 \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
-cursor $cursor_ptr \
|
-cursor $cursor_ptr \
|
||||||
@ -2408,12 +2445,13 @@ pack $ui_coml -side left -fill x
|
|||||||
pack .vpane.lower.commarea.buffer.header.amend -side right
|
pack .vpane.lower.commarea.buffer.header.amend -side right
|
||||||
pack .vpane.lower.commarea.buffer.header.new -side right
|
pack .vpane.lower.commarea.buffer.header.new -side right
|
||||||
|
|
||||||
text $ui_comm -background white -borderwidth 1 \
|
text $ui_comm -background white -foreground black \
|
||||||
|
-borderwidth 1 \
|
||||||
-undo true \
|
-undo true \
|
||||||
-maxundo 20 \
|
-maxundo 20 \
|
||||||
-autoseparators true \
|
-autoseparators true \
|
||||||
-relief sunken \
|
-relief sunken \
|
||||||
-width 75 -height 9 -wrap none \
|
-width $repo_config(gui.commitmsgwidth) -height 9 -wrap none \
|
||||||
-font font_diff \
|
-font font_diff \
|
||||||
-yscrollcommand {.vpane.lower.commarea.buffer.sby set}
|
-yscrollcommand {.vpane.lower.commarea.buffer.sby set}
|
||||||
scrollbar .vpane.lower.commarea.buffer.sby \
|
scrollbar .vpane.lower.commarea.buffer.sby \
|
||||||
@ -2454,7 +2492,7 @@ $ctxm add separator
|
|||||||
$ctxm add command \
|
$ctxm add command \
|
||||||
-label [mc "Sign Off"] \
|
-label [mc "Sign Off"] \
|
||||||
-command do_signoff
|
-command do_signoff
|
||||||
bind_button3 $ui_comm "tk_popup $ctxm %X %Y"
|
set ui_comm_ctxm $ctxm
|
||||||
|
|
||||||
# -- Diff Header
|
# -- Diff Header
|
||||||
#
|
#
|
||||||
@ -2485,15 +2523,18 @@ trace add variable current_diff_path write trace_current_diff_path
|
|||||||
frame .vpane.lower.diff.header -background gold
|
frame .vpane.lower.diff.header -background gold
|
||||||
label .vpane.lower.diff.header.status \
|
label .vpane.lower.diff.header.status \
|
||||||
-background gold \
|
-background gold \
|
||||||
|
-foreground black \
|
||||||
-width $max_status_desc \
|
-width $max_status_desc \
|
||||||
-anchor w \
|
-anchor w \
|
||||||
-justify left
|
-justify left
|
||||||
label .vpane.lower.diff.header.file \
|
label .vpane.lower.diff.header.file \
|
||||||
-background gold \
|
-background gold \
|
||||||
|
-foreground black \
|
||||||
-anchor w \
|
-anchor w \
|
||||||
-justify left
|
-justify left
|
||||||
label .vpane.lower.diff.header.path \
|
label .vpane.lower.diff.header.path \
|
||||||
-background gold \
|
-background gold \
|
||||||
|
-foreground black \
|
||||||
-anchor w \
|
-anchor w \
|
||||||
-justify left
|
-justify left
|
||||||
pack .vpane.lower.diff.header.status -side left
|
pack .vpane.lower.diff.header.status -side left
|
||||||
@ -2517,7 +2558,8 @@ bind_button3 .vpane.lower.diff.header.path "tk_popup $ctxm %X %Y"
|
|||||||
#
|
#
|
||||||
frame .vpane.lower.diff.body
|
frame .vpane.lower.diff.body
|
||||||
set ui_diff .vpane.lower.diff.body.t
|
set ui_diff .vpane.lower.diff.body.t
|
||||||
text $ui_diff -background white -borderwidth 0 \
|
text $ui_diff -background white -foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-width 80 -height 15 -wrap none \
|
-width 80 -height 15 -wrap none \
|
||||||
-font font_diff \
|
-font font_diff \
|
||||||
-xscrollcommand {.vpane.lower.diff.body.sbx set} \
|
-xscrollcommand {.vpane.lower.diff.body.sbx set} \
|
||||||
@ -2577,17 +2619,11 @@ lappend diff_actions [list $ctxm entryconf $ui_diff_applyhunk -state]
|
|||||||
$ctxm add separator
|
$ctxm add separator
|
||||||
$ctxm add command \
|
$ctxm add command \
|
||||||
-label [mc "Show Less Context"] \
|
-label [mc "Show Less Context"] \
|
||||||
-command {if {$repo_config(gui.diffcontext) >= 1} {
|
-command show_less_context
|
||||||
incr repo_config(gui.diffcontext) -1
|
|
||||||
reshow_diff
|
|
||||||
}}
|
|
||||||
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
|
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
|
||||||
$ctxm add command \
|
$ctxm add command \
|
||||||
-label [mc "Show More Context"] \
|
-label [mc "Show More Context"] \
|
||||||
-command {if {$repo_config(gui.diffcontext) < 99} {
|
-command show_more_context
|
||||||
incr repo_config(gui.diffcontext)
|
|
||||||
reshow_diff
|
|
||||||
}}
|
|
||||||
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
|
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
|
||||||
$ctxm add separator
|
$ctxm add separator
|
||||||
$ctxm add command \
|
$ctxm add command \
|
||||||
@ -2679,6 +2715,8 @@ bind $ui_comm <$M1B-Key-v> {tk_textPaste %W; %W see insert; break}
|
|||||||
bind $ui_comm <$M1B-Key-V> {tk_textPaste %W; %W see insert; break}
|
bind $ui_comm <$M1B-Key-V> {tk_textPaste %W; %W see insert; break}
|
||||||
bind $ui_comm <$M1B-Key-a> {%W tag add sel 0.0 end;break}
|
bind $ui_comm <$M1B-Key-a> {%W tag add sel 0.0 end;break}
|
||||||
bind $ui_comm <$M1B-Key-A> {%W tag add sel 0.0 end;break}
|
bind $ui_comm <$M1B-Key-A> {%W tag add sel 0.0 end;break}
|
||||||
|
bind $ui_comm <$M1B-Key-\[> {show_less_context;break}
|
||||||
|
bind $ui_comm <$M1B-Key-\]> {show_more_context;break}
|
||||||
|
|
||||||
bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break}
|
bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break}
|
||||||
bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break}
|
bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break}
|
||||||
@ -2722,6 +2760,8 @@ bind . <$M1B-Key-t> do_add_selection
|
|||||||
bind . <$M1B-Key-T> do_add_selection
|
bind . <$M1B-Key-T> do_add_selection
|
||||||
bind . <$M1B-Key-i> do_add_all
|
bind . <$M1B-Key-i> do_add_all
|
||||||
bind . <$M1B-Key-I> do_add_all
|
bind . <$M1B-Key-I> do_add_all
|
||||||
|
bind . <$M1B-Key-\[> {show_less_context;break}
|
||||||
|
bind . <$M1B-Key-\]> {show_more_context;break}
|
||||||
bind . <$M1B-Key-Return> do_commit
|
bind . <$M1B-Key-Return> do_commit
|
||||||
foreach i [list $ui_index $ui_workdir] {
|
foreach i [list $ui_index $ui_workdir] {
|
||||||
bind $i <Button-1> "toggle_or_diff $i %x %y; break"
|
bind $i <Button-1> "toggle_or_diff $i %x %y; break"
|
||||||
@ -2857,6 +2897,30 @@ if {[winfo exists $ui_comm]} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
backup_commit_buffer
|
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
|
lock_index begin-read
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
proc do_about {} {
|
proc do_about {} {
|
||||||
global appvers copyright oguilib
|
global appvers copyright oguilib
|
||||||
global tcl_patchLevel tk_patchLevel
|
global tcl_patchLevel tk_patchLevel
|
||||||
|
global ui_comm_spell
|
||||||
|
|
||||||
set w .about_dialog
|
set w .about_dialog
|
||||||
toplevel $w
|
toplevel $w
|
||||||
@ -40,6 +41,11 @@ proc do_about {} {
|
|||||||
append v "Tcl version $tcl_patchLevel"
|
append v "Tcl version $tcl_patchLevel"
|
||||||
append v ", Tk version $tk_patchLevel"
|
append v ", Tk version $tk_patchLevel"
|
||||||
}
|
}
|
||||||
|
if {[info exists ui_comm_spell]
|
||||||
|
&& [$ui_comm_spell version] ne {}} {
|
||||||
|
append v "\n"
|
||||||
|
append v [$ui_comm_spell version]
|
||||||
|
}
|
||||||
|
|
||||||
set d {}
|
set d {}
|
||||||
append d "git wrapper: $::_git\n"
|
append d "git wrapper: $::_git\n"
|
||||||
|
@ -80,6 +80,7 @@ constructor new {i_commit i_path} {
|
|||||||
label $w.header.commit_l \
|
label $w.header.commit_l \
|
||||||
-text [mc "Commit:"] \
|
-text [mc "Commit:"] \
|
||||||
-background gold \
|
-background gold \
|
||||||
|
-foreground black \
|
||||||
-anchor w \
|
-anchor w \
|
||||||
-justify left
|
-justify left
|
||||||
set w_back $w.header.commit_b
|
set w_back $w.header.commit_b
|
||||||
@ -89,6 +90,7 @@ constructor new {i_commit i_path} {
|
|||||||
-relief flat \
|
-relief flat \
|
||||||
-state disabled \
|
-state disabled \
|
||||||
-background gold \
|
-background gold \
|
||||||
|
-foreground black \
|
||||||
-activebackground gold
|
-activebackground gold
|
||||||
bind $w_back <Button-1> "
|
bind $w_back <Button-1> "
|
||||||
if {\[$w_back cget -state\] eq {normal}} {
|
if {\[$w_back cget -state\] eq {normal}} {
|
||||||
@ -98,16 +100,19 @@ constructor new {i_commit i_path} {
|
|||||||
label $w.header.commit \
|
label $w.header.commit \
|
||||||
-textvariable @commit \
|
-textvariable @commit \
|
||||||
-background gold \
|
-background gold \
|
||||||
|
-foreground black \
|
||||||
-anchor w \
|
-anchor w \
|
||||||
-justify left
|
-justify left
|
||||||
label $w.header.path_l \
|
label $w.header.path_l \
|
||||||
-text [mc "File:"] \
|
-text [mc "File:"] \
|
||||||
-background gold \
|
-background gold \
|
||||||
|
-foreground black \
|
||||||
-anchor w \
|
-anchor w \
|
||||||
-justify left
|
-justify left
|
||||||
set w_path $w.header.path
|
set w_path $w.header.path
|
||||||
label $w_path \
|
label $w_path \
|
||||||
-background gold \
|
-background gold \
|
||||||
|
-foreground black \
|
||||||
-anchor w \
|
-anchor w \
|
||||||
-justify left
|
-justify left
|
||||||
pack $w.header.commit_l -side left
|
pack $w.header.commit_l -side left
|
||||||
@ -135,7 +140,9 @@ constructor new {i_commit i_path} {
|
|||||||
-takefocus 0 \
|
-takefocus 0 \
|
||||||
-highlightthickness 0 \
|
-highlightthickness 0 \
|
||||||
-padx 0 -pady 0 \
|
-padx 0 -pady 0 \
|
||||||
-background white -borderwidth 0 \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-state disabled \
|
-state disabled \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
-height 40 \
|
-height 40 \
|
||||||
@ -148,7 +155,9 @@ constructor new {i_commit i_path} {
|
|||||||
-takefocus 0 \
|
-takefocus 0 \
|
||||||
-highlightthickness 0 \
|
-highlightthickness 0 \
|
||||||
-padx 0 -pady 0 \
|
-padx 0 -pady 0 \
|
||||||
-background white -borderwidth 0 \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-state disabled \
|
-state disabled \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
-height 40 \
|
-height 40 \
|
||||||
@ -166,7 +175,9 @@ constructor new {i_commit i_path} {
|
|||||||
-takefocus 0 \
|
-takefocus 0 \
|
||||||
-highlightthickness 0 \
|
-highlightthickness 0 \
|
||||||
-padx 0 -pady 0 \
|
-padx 0 -pady 0 \
|
||||||
-background white -borderwidth 0 \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-state disabled \
|
-state disabled \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
-height 40 \
|
-height 40 \
|
||||||
@ -184,7 +195,9 @@ constructor new {i_commit i_path} {
|
|||||||
-takefocus 0 \
|
-takefocus 0 \
|
||||||
-highlightthickness 0 \
|
-highlightthickness 0 \
|
||||||
-padx 0 -pady 0 \
|
-padx 0 -pady 0 \
|
||||||
-background white -borderwidth 0 \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-state disabled \
|
-state disabled \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
-height 40 \
|
-height 40 \
|
||||||
@ -213,7 +226,9 @@ constructor new {i_commit i_path} {
|
|||||||
|
|
||||||
set w_cviewer $w.file_pane.cm.t
|
set w_cviewer $w.file_pane.cm.t
|
||||||
text $w_cviewer \
|
text $w_cviewer \
|
||||||
-background white -borderwidth 0 \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-state disabled \
|
-state disabled \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
-height 10 \
|
-height 10 \
|
||||||
|
@ -39,7 +39,8 @@ constructor new {commit {path {}}} {
|
|||||||
|
|
||||||
frame $w.list
|
frame $w.list
|
||||||
set w_list $w.list.l
|
set w_list $w.list.l
|
||||||
text $w_list -background white -borderwidth 0 \
|
text $w_list -background white -foreground black \
|
||||||
|
-borderwidth 0 \
|
||||||
-cursor $cursor_ptr \
|
-cursor $cursor_ptr \
|
||||||
-state disabled \
|
-state disabled \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
|
@ -280,7 +280,7 @@ The rescan will be automatically started now.
|
|||||||
} elseif {[is_config_true gui.trustmtime]} {
|
} elseif {[is_config_true gui.trustmtime]} {
|
||||||
_readtree $this
|
_readtree $this
|
||||||
} else {
|
} else {
|
||||||
ui_status {Refreshing file status...}
|
ui_status [mc "Refreshing file status..."]
|
||||||
set fd [git_read update-index \
|
set fd [git_read update-index \
|
||||||
-q \
|
-q \
|
||||||
--unmerged \
|
--unmerged \
|
||||||
@ -320,7 +320,7 @@ method _readtree {} {
|
|||||||
set readtree_d {}
|
set readtree_d {}
|
||||||
$::main_status start \
|
$::main_status start \
|
||||||
[mc "Updating working directory to '%s'..." [_name $this]] \
|
[mc "Updating working directory to '%s'..." [_name $this]] \
|
||||||
{files checked out}
|
[mc "files checked out"]
|
||||||
|
|
||||||
set fd [git_read --stderr read-tree \
|
set fd [git_read --stderr read-tree \
|
||||||
-m \
|
-m \
|
||||||
@ -447,7 +447,7 @@ If you wanted to be on a branch, create one now starting from 'This Detached Che
|
|||||||
} else {
|
} else {
|
||||||
repository_state commit_type HEAD MERGE_HEAD
|
repository_state commit_type HEAD MERGE_HEAD
|
||||||
set PARENT $HEAD
|
set PARENT $HEAD
|
||||||
ui_status "Checked out '$name'."
|
ui_status [mc "Checked out '%s'." $name]
|
||||||
}
|
}
|
||||||
delete_this
|
delete_this
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ constructor pick {path title a_family a_size} {
|
|||||||
set w_family $w.inner.family.v
|
set w_family $w.inner.family.v
|
||||||
text $w_family \
|
text $w_family \
|
||||||
-background white \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
-borderwidth 1 \
|
-borderwidth 1 \
|
||||||
-relief sunken \
|
-relief sunken \
|
||||||
-cursor $::cursor_ptr \
|
-cursor $::cursor_ptr \
|
||||||
@ -92,6 +93,7 @@ constructor pick {path title a_family a_size} {
|
|||||||
set w_example $w.example.t
|
set w_example $w.example.t
|
||||||
text $w_example \
|
text $w_example \
|
||||||
-background white \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
-borderwidth 1 \
|
-borderwidth 1 \
|
||||||
-relief sunken \
|
-relief sunken \
|
||||||
-height 3 \
|
-height 3 \
|
||||||
|
@ -38,7 +38,7 @@ constructor pick {} {
|
|||||||
menu $m_repo
|
menu $m_repo
|
||||||
|
|
||||||
if {[is_MacOSX]} {
|
if {[is_MacOSX]} {
|
||||||
$w.mbar add cascade -label [mc Apple] -menu .mbar.apple
|
$w.mbar add cascade -label Apple -menu .mbar.apple
|
||||||
menu $w.mbar.apple
|
menu $w.mbar.apple
|
||||||
$w.mbar.apple add command \
|
$w.mbar.apple add command \
|
||||||
-label [mc "About %s" [appname]] \
|
-label [mc "About %s" [appname]] \
|
||||||
|
@ -218,7 +218,7 @@ A good commit message has the following format:
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_status {Calling pre-commit hook...}
|
ui_status [mc "Calling pre-commit hook..."]
|
||||||
set pch_error {}
|
set pch_error {}
|
||||||
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
|
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
|
||||||
fileevent $fd_ph readable \
|
fileevent $fd_ph readable \
|
||||||
@ -233,7 +233,7 @@ proc commit_prehook_wait {fd_ph curHEAD msg_p} {
|
|||||||
if {[eof $fd_ph]} {
|
if {[eof $fd_ph]} {
|
||||||
if {[catch {close $fd_ph}]} {
|
if {[catch {close $fd_ph}]} {
|
||||||
catch {file delete $msg_p}
|
catch {file delete $msg_p}
|
||||||
ui_status {Commit declined by pre-commit hook.}
|
ui_status [mc "Commit declined by pre-commit hook."]
|
||||||
hook_failed_popup pre-commit $pch_error
|
hook_failed_popup pre-commit $pch_error
|
||||||
unlock_index
|
unlock_index
|
||||||
} else {
|
} else {
|
||||||
@ -256,7 +256,7 @@ proc commit_commitmsg {curHEAD msg_p} {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_status {Calling commit-msg hook...}
|
ui_status [mc "Calling commit-msg hook..."]
|
||||||
set pch_error {}
|
set pch_error {}
|
||||||
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
|
fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
|
||||||
fileevent $fd_ph readable \
|
fileevent $fd_ph readable \
|
||||||
@ -271,7 +271,7 @@ proc commit_commitmsg_wait {fd_ph curHEAD msg_p} {
|
|||||||
if {[eof $fd_ph]} {
|
if {[eof $fd_ph]} {
|
||||||
if {[catch {close $fd_ph}]} {
|
if {[catch {close $fd_ph}]} {
|
||||||
catch {file delete $msg_p}
|
catch {file delete $msg_p}
|
||||||
ui_status {Commit declined by commit-msg hook.}
|
ui_status [mc "Commit declined by commit-msg hook."]
|
||||||
hook_failed_popup commit-msg $pch_error
|
hook_failed_popup commit-msg $pch_error
|
||||||
unlock_index
|
unlock_index
|
||||||
} else {
|
} else {
|
||||||
@ -284,7 +284,7 @@ proc commit_commitmsg_wait {fd_ph curHEAD msg_p} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc commit_writetree {curHEAD msg_p} {
|
proc commit_writetree {curHEAD msg_p} {
|
||||||
ui_status {Committing changes...}
|
ui_status [mc "Committing changes..."]
|
||||||
set fd_wt [git_read write-tree]
|
set fd_wt [git_read write-tree]
|
||||||
fileevent $fd_wt readable \
|
fileevent $fd_wt readable \
|
||||||
[list commit_committree $fd_wt $curHEAD $msg_p]
|
[list commit_committree $fd_wt $curHEAD $msg_p]
|
||||||
@ -301,7 +301,7 @@ proc commit_committree {fd_wt curHEAD msg_p} {
|
|||||||
if {[catch {close $fd_wt} err]} {
|
if {[catch {close $fd_wt} err]} {
|
||||||
catch {file delete $msg_p}
|
catch {file delete $msg_p}
|
||||||
error_popup [strcat [mc "write-tree failed:"] "\n\n$err"]
|
error_popup [strcat [mc "write-tree failed:"] "\n\n$err"]
|
||||||
ui_status {Commit failed.}
|
ui_status [mc "Commit failed."]
|
||||||
unlock_index
|
unlock_index
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -345,7 +345,7 @@ A rescan will be automatically started now.
|
|||||||
if {[catch {set cmt_id [eval git $cmd]} err]} {
|
if {[catch {set cmt_id [eval git $cmd]} err]} {
|
||||||
catch {file delete $msg_p}
|
catch {file delete $msg_p}
|
||||||
error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
|
error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
|
||||||
ui_status {Commit failed.}
|
ui_status [mc "Commit failed."]
|
||||||
unlock_index
|
unlock_index
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -365,7 +365,7 @@ A rescan will be automatically started now.
|
|||||||
} err]} {
|
} err]} {
|
||||||
catch {file delete $msg_p}
|
catch {file delete $msg_p}
|
||||||
error_popup [strcat [mc "update-ref failed:"] "\n\n$err"]
|
error_popup [strcat [mc "update-ref failed:"] "\n\n$err"]
|
||||||
ui_status {Commit failed.}
|
ui_status [mc "Commit failed."]
|
||||||
unlock_index
|
unlock_index
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,9 @@ method _init {} {
|
|||||||
-justify left \
|
-justify left \
|
||||||
-font font_uibold
|
-font font_uibold
|
||||||
text $w_t \
|
text $w_t \
|
||||||
-background white -borderwidth 1 \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
|
-borderwidth 1 \
|
||||||
-relief sunken \
|
-relief sunken \
|
||||||
-width 80 -height 10 \
|
-width 80 -height 10 \
|
||||||
-wrap none \
|
-wrap none \
|
||||||
@ -180,7 +182,8 @@ method done {ok} {
|
|||||||
if {$ok} {
|
if {$ok} {
|
||||||
if {[winfo exists $w.m.s]} {
|
if {[winfo exists $w.m.s]} {
|
||||||
bind $w.m.s <Destroy> [list delete_this $this]
|
bind $w.m.s <Destroy> [list delete_this $this]
|
||||||
$w.m.s conf -background green -text [mc "Success"]
|
$w.m.s conf -background green -foreground black \
|
||||||
|
-text [mc "Success"]
|
||||||
if {$is_toplevel} {
|
if {$is_toplevel} {
|
||||||
$w.ok conf -state normal
|
$w.ok conf -state normal
|
||||||
focus $w.ok
|
focus $w.ok
|
||||||
@ -193,7 +196,8 @@ method done {ok} {
|
|||||||
_init $this
|
_init $this
|
||||||
}
|
}
|
||||||
bind $w.m.s <Destroy> [list delete_this $this]
|
bind $w.m.s <Destroy> [list delete_this $this]
|
||||||
$w.m.s conf -background red -text [mc "Error: Command Failed"]
|
$w.m.s conf -background red -foreground black \
|
||||||
|
-text [mc "Error: Command Failed"]
|
||||||
if {$is_toplevel} {
|
if {$is_toplevel} {
|
||||||
$w.ok conf -state normal
|
$w.ok conf -state normal
|
||||||
focus $w.ok
|
focus $w.ok
|
||||||
|
@ -80,7 +80,9 @@ proc hook_failed_popup {hook msg {is_fatal 1}} {
|
|||||||
-justify left \
|
-justify left \
|
||||||
-font font_uibold
|
-font font_uibold
|
||||||
text $w.m.t \
|
text $w.m.t \
|
||||||
-background white -borderwidth 1 \
|
-background white \
|
||||||
|
-foreground black \
|
||||||
|
-borderwidth 1 \
|
||||||
-relief sunken \
|
-relief sunken \
|
||||||
-width 80 -height 10 \
|
-width 80 -height 10 \
|
||||||
-font font_diff \
|
-font font_diff \
|
||||||
|
@ -310,7 +310,7 @@ proc add_helper {txt paths} {
|
|||||||
update_index \
|
update_index \
|
||||||
$txt \
|
$txt \
|
||||||
$pathList \
|
$pathList \
|
||||||
[concat $after {ui_status {Ready to commit.}}]
|
[concat $after {ui_status [mc "Ready to commit."]}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,8 +116,7 @@ method _start {} {
|
|||||||
lappend cmd HEAD
|
lappend cmd HEAD
|
||||||
lappend cmd $name
|
lappend cmd $name
|
||||||
|
|
||||||
set msg [mc "Merging %s and %s" $current_branch $stitle]
|
ui_status [mc "Merging %s and %s..." $current_branch $stitle]
|
||||||
ui_status "$msg..."
|
|
||||||
set cons [console::new [mc "Merge"] "merge $stitle"]
|
set cons [console::new [mc "Merge"] "merge $stitle"]
|
||||||
console::exec $cons $cmd [cb _finish $cons]
|
console::exec $cons $cmd [cb _finish $cons]
|
||||||
|
|
||||||
@ -236,7 +235,7 @@ Continue with resetting the current changes?"]
|
|||||||
set fd [git_read --stderr read-tree --reset -u -v HEAD]
|
set fd [git_read --stderr read-tree --reset -u -v HEAD]
|
||||||
fconfigure $fd -blocking 0 -translation binary
|
fconfigure $fd -blocking 0 -translation binary
|
||||||
fileevent $fd readable [namespace code [list _reset_wait $fd]]
|
fileevent $fd readable [namespace code [list _reset_wait $fd]]
|
||||||
$::main_status start [mc "Aborting"] {files reset}
|
$::main_status start [mc "Aborting"] [mc "files reset"]
|
||||||
} else {
|
} else {
|
||||||
unlock_index
|
unlock_index
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ proc save_config {} {
|
|||||||
global default_config font_descs
|
global default_config font_descs
|
||||||
global repo_config global_config
|
global repo_config global_config
|
||||||
global repo_config_new global_config_new
|
global repo_config_new global_config_new
|
||||||
|
global ui_comm_spell
|
||||||
|
|
||||||
foreach option $font_descs {
|
foreach option $font_descs {
|
||||||
set name [lindex $option 0]
|
set name [lindex $option 0]
|
||||||
@ -52,11 +53,23 @@ proc save_config {} {
|
|||||||
set repo_config($name) $value
|
set repo_config($name) $value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if {[info exists repo_config(gui.spellingdictionary)]} {
|
||||||
|
set value $repo_config(gui.spellingdictionary)
|
||||||
|
if {$value eq {none}} {
|
||||||
|
if {[info exists ui_comm_spell]} {
|
||||||
|
$ui_comm_spell stop
|
||||||
|
}
|
||||||
|
} elseif {[info exists ui_comm_spell]} {
|
||||||
|
$ui_comm_spell lang $value
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc do_options {} {
|
proc do_options {} {
|
||||||
global repo_config global_config font_descs
|
global repo_config global_config font_descs
|
||||||
global repo_config_new global_config_new
|
global repo_config_new global_config_new
|
||||||
|
global ui_comm_spell
|
||||||
|
|
||||||
array unset repo_config_new
|
array unset repo_config_new
|
||||||
array unset global_config_new
|
array unset global_config_new
|
||||||
@ -111,6 +124,7 @@ proc do_options {} {
|
|||||||
{b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
|
{b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
|
||||||
{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
|
{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
|
||||||
{i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
|
{i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
|
||||||
|
{i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
|
||||||
{t gui.newbranchtemplate {mc "New Branch Name Template"}}
|
{t gui.newbranchtemplate {mc "New Branch Name Template"}}
|
||||||
} {
|
} {
|
||||||
set type [lindex $option 0]
|
set type [lindex $option 0]
|
||||||
@ -159,6 +173,32 @@ proc do_options {} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set all_dicts [linsert \
|
||||||
|
[spellcheck::available_langs] \
|
||||||
|
0 \
|
||||||
|
none]
|
||||||
|
incr optid
|
||||||
|
foreach f {repo global} {
|
||||||
|
if {![info exists ${f}_config_new(gui.spellingdictionary)]} {
|
||||||
|
if {[info exists ui_comm_spell]} {
|
||||||
|
set value [$ui_comm_spell lang]
|
||||||
|
} else {
|
||||||
|
set value none
|
||||||
|
}
|
||||||
|
set ${f}_config_new(gui.spellingdictionary) $value
|
||||||
|
}
|
||||||
|
|
||||||
|
frame $w.$f.$optid
|
||||||
|
label $w.$f.$optid.l -text [mc "Spelling Dictionary:"]
|
||||||
|
eval tk_optionMenu $w.$f.$optid.v \
|
||||||
|
${f}_config_new(gui.spellingdictionary) \
|
||||||
|
$all_dicts
|
||||||
|
pack $w.$f.$optid.l -side left -anchor w -fill x
|
||||||
|
pack $w.$f.$optid.v -side right -anchor e -padx 5
|
||||||
|
pack $w.$f.$optid -side top -anchor w -fill x
|
||||||
|
}
|
||||||
|
unset all_dicts
|
||||||
|
|
||||||
set all_fonts [lsort [font families]]
|
set all_fonts [lsort [font families]]
|
||||||
foreach option $font_descs {
|
foreach option $font_descs {
|
||||||
set name [lindex $option 0]
|
set name [lindex $option 0]
|
||||||
|
408
lib/spellcheck.tcl
Normal file
408
lib/spellcheck.tcl
Normal file
@ -0,0 +1,408 @@
|
|||||||
|
# git-gui spellchecking support through ispell/aspell
|
||||||
|
# Copyright (C) 2008 Shawn Pearce
|
||||||
|
|
||||||
|
class spellcheck {
|
||||||
|
|
||||||
|
field s_fd {} ; # pipe to ispell/aspell
|
||||||
|
field s_version {} ; # ispell/aspell version string
|
||||||
|
field s_lang {} ; # current language code
|
||||||
|
field s_prog aspell; # are we actually old ispell?
|
||||||
|
field s_failed 0 ; # is $s_prog bogus and not working?
|
||||||
|
|
||||||
|
field w_text ; # text widget we are spelling
|
||||||
|
field w_menu ; # context menu for the widget
|
||||||
|
field s_menuidx 0 ; # last index of insertion into $w_menu
|
||||||
|
|
||||||
|
field s_i {} ; # timer registration for _run callbacks
|
||||||
|
field s_clear 0 ; # did we erase mispelled tags yet?
|
||||||
|
field s_seen [list] ; # lines last seen from $w_text in _run
|
||||||
|
field s_checked [list] ; # lines already checked
|
||||||
|
field s_pending [list] ; # [$line $data] sent to ispell/aspell
|
||||||
|
field s_suggest ; # array, list of suggestions, keyed by misspelling
|
||||||
|
|
||||||
|
constructor init {pipe_fd ui_text ui_menu} {
|
||||||
|
set w_text $ui_text
|
||||||
|
set w_menu $ui_menu
|
||||||
|
array unset s_suggest
|
||||||
|
|
||||||
|
bind_button3 $w_text [cb _popup_suggest %X %Y @%x,%y]
|
||||||
|
_connect $this $pipe_fd
|
||||||
|
return $this
|
||||||
|
}
|
||||||
|
|
||||||
|
method _connect {pipe_fd} {
|
||||||
|
fconfigure $pipe_fd \
|
||||||
|
-encoding utf-8 \
|
||||||
|
-eofchar {} \
|
||||||
|
-translation lf
|
||||||
|
|
||||||
|
if {[gets $pipe_fd s_version] <= 0} {
|
||||||
|
if {[catch {close $pipe_fd} err]} {
|
||||||
|
|
||||||
|
# Eh? Is this actually ispell choking on aspell options?
|
||||||
|
#
|
||||||
|
if {$s_prog eq {aspell}
|
||||||
|
&& [regexp -nocase {^Usage: } $err]
|
||||||
|
&& ![catch {
|
||||||
|
set pipe_fd [open [list | $s_prog -v] r]
|
||||||
|
gets $pipe_fd s_version
|
||||||
|
close $pipe_fd
|
||||||
|
}]
|
||||||
|
&& $s_version ne {}} {
|
||||||
|
if {{@(#) } eq [string range $s_version 0 4]} {
|
||||||
|
set s_version [string range $s_version 5 end]
|
||||||
|
}
|
||||||
|
set s_failed 1
|
||||||
|
error_popup [strcat \
|
||||||
|
[mc "Unsupported spell checker"] \
|
||||||
|
":\n\n$s_version"]
|
||||||
|
set s_version {}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
regsub -nocase {^Error: } $err {} err
|
||||||
|
if {$s_fd eq {}} {
|
||||||
|
error_popup [strcat [mc "Spell checking is unavailable"] ":\n\n$err"]
|
||||||
|
} else {
|
||||||
|
error_popup [strcat \
|
||||||
|
[mc "Invalid spell checking configuration"] \
|
||||||
|
":\n\n$err\n\n" \
|
||||||
|
[mc "Reverting dictionary to %s." $s_lang]]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
error_popup [mc "Spell checker silently failed on startup"]
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if {{@(#) } ne [string range $s_version 0 4]} {
|
||||||
|
catch {close $pipe_fd}
|
||||||
|
error_popup [strcat [mc "Unrecognized spell checker"] ":\n\n$s_version"]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
set s_version [string range $s_version 5 end]
|
||||||
|
regexp \
|
||||||
|
{International Ispell Version .* \(but really (Aspell .*?)\)$} \
|
||||||
|
$s_version _junk s_version
|
||||||
|
|
||||||
|
puts $pipe_fd ! ; # enable terse mode
|
||||||
|
puts $pipe_fd {$$cr master} ; # fetch the language
|
||||||
|
flush $pipe_fd
|
||||||
|
|
||||||
|
gets $pipe_fd s_lang
|
||||||
|
regexp {[/\\]([^/\\]+)\.[^\.]+$} $s_lang _ s_lang
|
||||||
|
|
||||||
|
if {$::default_config(gui.spellingdictionary) eq {}
|
||||||
|
&& [get_config gui.spellingdictionary] eq {}} {
|
||||||
|
set ::default_config(gui.spellingdictionary) $s_lang
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$s_fd ne {}} {
|
||||||
|
catch {close $s_fd}
|
||||||
|
}
|
||||||
|
set s_fd $pipe_fd
|
||||||
|
|
||||||
|
fconfigure $s_fd -blocking 0
|
||||||
|
fileevent $s_fd readable [cb _read]
|
||||||
|
|
||||||
|
$w_text tag conf misspelled \
|
||||||
|
-foreground red \
|
||||||
|
-underline 1
|
||||||
|
|
||||||
|
array unset s_suggest
|
||||||
|
set s_seen [list]
|
||||||
|
set s_checked [list]
|
||||||
|
set s_pending [list]
|
||||||
|
_run $this
|
||||||
|
}
|
||||||
|
|
||||||
|
method lang {{n {}}} {
|
||||||
|
if {$n ne {} && $s_lang ne $n && !$s_failed} {
|
||||||
|
set spell_cmd [list |]
|
||||||
|
lappend spell_cmd aspell
|
||||||
|
lappend spell_cmd --master=$n
|
||||||
|
lappend spell_cmd --mode=none
|
||||||
|
lappend spell_cmd --encoding=UTF-8
|
||||||
|
lappend spell_cmd pipe
|
||||||
|
_connect $this [open $spell_cmd r+]
|
||||||
|
}
|
||||||
|
return $s_lang
|
||||||
|
}
|
||||||
|
|
||||||
|
method version {} {
|
||||||
|
if {$s_version ne {}} {
|
||||||
|
return "$s_version, $s_lang"
|
||||||
|
}
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
method stop {} {
|
||||||
|
while {$s_menuidx > 0} {
|
||||||
|
$w_menu delete 0
|
||||||
|
incr s_menuidx -1
|
||||||
|
}
|
||||||
|
$w_text tag delete misspelled
|
||||||
|
|
||||||
|
catch {close $s_fd}
|
||||||
|
catch {after cancel $s_i}
|
||||||
|
set s_fd {}
|
||||||
|
set s_i {}
|
||||||
|
set s_lang {}
|
||||||
|
}
|
||||||
|
|
||||||
|
method _popup_suggest {X Y pos} {
|
||||||
|
while {$s_menuidx > 0} {
|
||||||
|
$w_menu delete 0
|
||||||
|
incr s_menuidx -1
|
||||||
|
}
|
||||||
|
|
||||||
|
set b_loc [$w_text index "$pos wordstart"]
|
||||||
|
set e_loc [_wordend $this $b_loc]
|
||||||
|
set orig [$w_text get $b_loc $e_loc]
|
||||||
|
set tags [$w_text tag names $b_loc]
|
||||||
|
|
||||||
|
if {[lsearch -exact $tags misspelled] >= 0} {
|
||||||
|
if {[info exists s_suggest($orig)]} {
|
||||||
|
set cnt 0
|
||||||
|
foreach s $s_suggest($orig) {
|
||||||
|
if {$cnt < 5} {
|
||||||
|
$w_menu insert $s_menuidx command \
|
||||||
|
-label $s \
|
||||||
|
-command [cb _replace $b_loc $e_loc $s]
|
||||||
|
incr s_menuidx
|
||||||
|
incr cnt
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$w_menu insert $s_menuidx command \
|
||||||
|
-label [mc "No Suggestions"] \
|
||||||
|
-state disabled
|
||||||
|
incr s_menuidx
|
||||||
|
}
|
||||||
|
$w_menu insert $s_menuidx separator
|
||||||
|
incr s_menuidx
|
||||||
|
}
|
||||||
|
|
||||||
|
$w_text mark set saved-insert insert
|
||||||
|
tk_popup $w_menu $X $Y
|
||||||
|
}
|
||||||
|
|
||||||
|
method _replace {b_loc e_loc word} {
|
||||||
|
$w_text configure -autoseparators 0
|
||||||
|
$w_text edit separator
|
||||||
|
|
||||||
|
$w_text delete $b_loc $e_loc
|
||||||
|
$w_text insert $b_loc $word
|
||||||
|
|
||||||
|
$w_text edit separator
|
||||||
|
$w_text configure -autoseparators 1
|
||||||
|
$w_text mark set insert saved-insert
|
||||||
|
}
|
||||||
|
|
||||||
|
method _restart_timer {} {
|
||||||
|
set s_i [after 300 [cb _run]]
|
||||||
|
}
|
||||||
|
|
||||||
|
proc _match_length {max_line arr_name} {
|
||||||
|
upvar $arr_name a
|
||||||
|
|
||||||
|
if {[llength $a] > $max_line} {
|
||||||
|
set a [lrange $a 0 $max_line]
|
||||||
|
}
|
||||||
|
while {[llength $a] <= $max_line} {
|
||||||
|
lappend a {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
method _wordend {pos} {
|
||||||
|
set pos [$w_text index "$pos wordend"]
|
||||||
|
set tags [$w_text tag names $pos]
|
||||||
|
while {[lsearch -exact $tags misspelled] >= 0} {
|
||||||
|
set pos [$w_text index "$pos +1c"]
|
||||||
|
set tags [$w_text tag names $pos]
|
||||||
|
}
|
||||||
|
return $pos
|
||||||
|
}
|
||||||
|
|
||||||
|
method _run {} {
|
||||||
|
set cur_pos [$w_text index {insert -1c}]
|
||||||
|
set cur_line [lindex [split $cur_pos .] 0]
|
||||||
|
set max_line [lindex [split [$w_text index end] .] 0]
|
||||||
|
_match_length $max_line s_seen
|
||||||
|
_match_length $max_line s_checked
|
||||||
|
|
||||||
|
# Nothing in the message buffer? Nothing to spellcheck.
|
||||||
|
#
|
||||||
|
if {$cur_line == 1
|
||||||
|
&& $max_line == 2
|
||||||
|
&& [$w_text get 1.0 end] eq "\n"} {
|
||||||
|
array unset s_suggest
|
||||||
|
_restart_timer $this
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
set active 0
|
||||||
|
for {set n 1} {$n <= $max_line} {incr n} {
|
||||||
|
set s [$w_text get "$n.0" "$n.end"]
|
||||||
|
|
||||||
|
# Don't spellcheck the current line unless we are at
|
||||||
|
# a word boundary. The user might be typing on it.
|
||||||
|
#
|
||||||
|
if {$n == $cur_line
|
||||||
|
&& ![regexp {^\W$} [$w_text get $cur_pos insert]]} {
|
||||||
|
|
||||||
|
# If the current word is mispelled remove the tag
|
||||||
|
# but force a spellcheck later.
|
||||||
|
#
|
||||||
|
set tags [$w_text tag names $cur_pos]
|
||||||
|
if {[lsearch -exact $tags misspelled] >= 0} {
|
||||||
|
$w_text tag remove misspelled \
|
||||||
|
"$cur_pos wordstart" \
|
||||||
|
[_wordend $this $cur_pos]
|
||||||
|
lset s_seen $n $s
|
||||||
|
lset s_checked $n {}
|
||||||
|
}
|
||||||
|
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if {[lindex $s_seen $n] eq $s
|
||||||
|
&& [lindex $s_checked $n] ne $s} {
|
||||||
|
# Don't send empty lines to Aspell it doesn't check them.
|
||||||
|
#
|
||||||
|
if {$s eq {}} {
|
||||||
|
lset s_checked $n $s
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
# Don't send typical s-b-o lines as the emails are
|
||||||
|
# almost always misspelled according to Aspell.
|
||||||
|
#
|
||||||
|
if {[regexp -nocase {^[a-z-]+-by:.*<.*@.*>$} $s]} {
|
||||||
|
$w_text tag remove misspelled "$n.0" "$n.end"
|
||||||
|
lset s_checked $n $s
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
puts $s_fd ^$s
|
||||||
|
lappend s_pending [list $n $s]
|
||||||
|
set active 1
|
||||||
|
} else {
|
||||||
|
# Delay until another idle loop to make sure we don't
|
||||||
|
# spellcheck lines the user is actively changing.
|
||||||
|
#
|
||||||
|
lset s_seen $n $s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$active} {
|
||||||
|
set s_clear 1
|
||||||
|
flush $s_fd
|
||||||
|
} else {
|
||||||
|
_restart_timer $this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
method _read {} {
|
||||||
|
while {[gets $s_fd line] >= 0} {
|
||||||
|
set lineno [lindex $s_pending 0 0]
|
||||||
|
|
||||||
|
if {$s_clear} {
|
||||||
|
$w_text tag remove misspelled "$lineno.0" "$lineno.end"
|
||||||
|
set s_clear 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$line eq {}} {
|
||||||
|
lset s_checked $lineno [lindex $s_pending 0 1]
|
||||||
|
set s_pending [lrange $s_pending 1 end]
|
||||||
|
set s_clear 1
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set sugg [list]
|
||||||
|
switch -- [string range $line 0 1] {
|
||||||
|
{& } {
|
||||||
|
set line [split [string range $line 2 end] :]
|
||||||
|
set info [split [lindex $line 0] { }]
|
||||||
|
set orig [lindex $info 0]
|
||||||
|
set offs [lindex $info 2]
|
||||||
|
foreach s [split [lindex $line 1] ,] {
|
||||||
|
lappend sugg [string range $s 1 end]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{# } {
|
||||||
|
set info [split [string range $line 2 end] { }]
|
||||||
|
set orig [lindex $info 0]
|
||||||
|
set offs [lindex $info 1]
|
||||||
|
}
|
||||||
|
default {
|
||||||
|
puts stderr "<spell> $line"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
incr offs -1
|
||||||
|
set b_loc "$lineno.$offs"
|
||||||
|
set e_loc [$w_text index "$lineno.$offs wordend"]
|
||||||
|
set curr [$w_text get $b_loc $e_loc]
|
||||||
|
|
||||||
|
# At least for English curr = "bob", orig = "bob's"
|
||||||
|
# so Tk didn't include the 's but Aspell did. We
|
||||||
|
# try to round out the word.
|
||||||
|
#
|
||||||
|
while {$curr ne $orig
|
||||||
|
&& [string equal -length [string length $curr] $curr $orig]} {
|
||||||
|
set n_loc [$w_text index "$e_loc +1c"]
|
||||||
|
set n_curr [$w_text get $b_loc $n_loc]
|
||||||
|
if {$n_curr eq $curr} {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
set curr $n_curr
|
||||||
|
set e_loc $n_loc
|
||||||
|
}
|
||||||
|
|
||||||
|
if {$curr eq $orig} {
|
||||||
|
$w_text tag add misspelled $b_loc $e_loc
|
||||||
|
if {[llength $sugg] > 0} {
|
||||||
|
set s_suggest($orig) $sugg
|
||||||
|
} else {
|
||||||
|
unset -nocomplain s_suggest($orig)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unset -nocomplain s_suggest($orig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fconfigure $s_fd -block 1
|
||||||
|
if {[eof $s_fd]} {
|
||||||
|
if {![catch {close $s_fd} err]} {
|
||||||
|
set err [mc "Unexpected EOF from spell checker"]
|
||||||
|
}
|
||||||
|
catch {after cancel $s_i}
|
||||||
|
$w_text tag remove misspelled 1.0 end
|
||||||
|
error_popup [strcat [mc "Spell Checker Failed"] "\n\n" $err]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fconfigure $s_fd -block 0
|
||||||
|
|
||||||
|
if {[llength $s_pending] == 0} {
|
||||||
|
_restart_timer $this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc available_langs {} {
|
||||||
|
set langs [list]
|
||||||
|
catch {
|
||||||
|
set fd [open [list | aspell dump dicts] r]
|
||||||
|
while {[gets $fd line] >= 0} {
|
||||||
|
if {$line eq {}} continue
|
||||||
|
lappend langs $line
|
||||||
|
}
|
||||||
|
close $fd
|
||||||
|
}
|
||||||
|
return $langs
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
62
po/README
62
po/README
@ -178,18 +178,6 @@ step.
|
|||||||
|
|
||||||
$ msgmerge -U po/af.po po/git-gui.pot
|
$ msgmerge -U po/af.po po/git-gui.pot
|
||||||
|
|
||||||
[NEEDSWORK: who is responsible for updating po/git-gui.pot file by
|
|
||||||
running xgettext? IIRC, Christian recommended against running it
|
|
||||||
nilly-willy because it can become a source of unnecessary merge
|
|
||||||
conflicts. Perhaps we should mention something like "
|
|
||||||
|
|
||||||
The po/git-gui.pot file is updated by the internationalization
|
|
||||||
coordinator from time to time. You _could_ update it yourself, but
|
|
||||||
translators are discouraged from doing so because we would want all
|
|
||||||
language teams to be working off of the same version of git-gui.pot.
|
|
||||||
|
|
||||||
" here?]
|
|
||||||
|
|
||||||
This updates po/af.po (again, replace "af" with your language
|
This updates po/af.po (again, replace "af" with your language
|
||||||
code) so that it contains msgid lines (i.e. the original) that
|
code) so that it contains msgid lines (i.e. the original) that
|
||||||
your translation did not have before. There are a few things to
|
your translation did not have before. There are a few things to
|
||||||
@ -207,3 +195,53 @@ watch out for:
|
|||||||
|
|
||||||
- New messages added to the software will have msgstr lines with empty
|
- New messages added to the software will have msgstr lines with empty
|
||||||
strings. You would need to translate them.
|
strings. You would need to translate them.
|
||||||
|
|
||||||
|
The po/git-gui.pot file is updated by the internationalization
|
||||||
|
coordinator from time to time. You _could_ update it yourself, but
|
||||||
|
translators are discouraged from doing so because we would want all
|
||||||
|
language teams to be working off of the same version of git-gui.pot.
|
||||||
|
|
||||||
|
****************************************************************
|
||||||
|
|
||||||
|
This section is a note to the internationalization coordinator, and
|
||||||
|
translators do not have to worry about it too much.
|
||||||
|
|
||||||
|
The message template file po/git-gui.pot needs to be kept up to date
|
||||||
|
relative to the software the translations apply to, and it is the
|
||||||
|
responsibility of the internationalization coordinator.
|
||||||
|
|
||||||
|
When updating po/git-gui.pot file, however, _never_ run "msgmerge -U
|
||||||
|
po/xx.po" for individual language translations, unless you are absolutely
|
||||||
|
sure that there is no outstanding work on translation for language xx.
|
||||||
|
Doing so will create unnecessary merge conflicts and force needless
|
||||||
|
re-translation on translators. The translator however may not have access
|
||||||
|
to the msgmerge tool, in which case the coordinator may run it for the
|
||||||
|
translator as a service.
|
||||||
|
|
||||||
|
But mistakes do happen. Suppose a translation was based on an older
|
||||||
|
version X, the POT file was updated at version Y and then msgmerge was run
|
||||||
|
at version Z for the language, and the translator sent in a patch based on
|
||||||
|
version X:
|
||||||
|
|
||||||
|
? translated
|
||||||
|
/
|
||||||
|
---X---Y---Z (master)
|
||||||
|
|
||||||
|
The coordinator could recover from such a mistake by first applying the
|
||||||
|
patch to X, replace the translated file in Z, and then running msgmerge
|
||||||
|
again based on the updated POT file and commit the result. The sequence
|
||||||
|
would look like this:
|
||||||
|
|
||||||
|
$ git checkout X
|
||||||
|
$ git am -s xx.patch
|
||||||
|
$ git checkout master
|
||||||
|
$ git checkout HEAD@{1} po/xx.po
|
||||||
|
$ msgmerge -U po/xx.po po/git-gui.pot
|
||||||
|
$ git commit -c HEAD@{1} po/xx.po
|
||||||
|
|
||||||
|
State in the message that the translated messages are based on a slightly
|
||||||
|
older version, and msgmerge was run to incorporate changes to message
|
||||||
|
templates from the updated POT file. The result needs to be further
|
||||||
|
translated, but at least the messages that were updated by the patch that
|
||||||
|
were not changed by the POT update will survive the process and do not
|
||||||
|
need to be re-translated.
|
||||||
|
599
po/git-gui.pot
599
po/git-gui.pot
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: git-gui glossary\n"
|
"Project-Id-Version: git-gui glossary\n"
|
||||||
"POT-Creation-Date: 2008-01-07 21:20+0100\n"
|
"POT-Creation-Date: 2008-01-07 21:20+0100\n"
|
||||||
"PO-Revision-Date: 2008-01-15 20:32+0100\n"
|
"PO-Revision-Date: 2008-02-16 21:48+0100\n"
|
||||||
"Last-Translator: Christian Stimming <stimming@tuhh.de>\n"
|
"Last-Translator: Christian Stimming <stimming@tuhh.de>\n"
|
||||||
"Language-Team: German \n"
|
"Language-Team: German \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@ -114,7 +114,7 @@ msgstr "Beschreibung (Meldung?, Nachricht?; Source Safe: Kommentar)"
|
|||||||
|
|
||||||
#. "Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in 'remotes/<name>'."
|
#. "Deletes all stale tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in 'remotes/<name>'."
|
||||||
msgid "prune"
|
msgid "prune"
|
||||||
msgstr "entfernen"
|
msgstr "aufräumen (entfernen?)"
|
||||||
|
|
||||||
#. "Pulling a branch means to fetch it and merge it."
|
#. "Pulling a branch means to fetch it and merge it."
|
||||||
msgid "pull"
|
msgid "pull"
|
||||||
|
1502
po/zh_cn.po
1502
po/zh_cn.po
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user