diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-09-17 23:50:17 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-17 23:50:17 -0700 |
commit | 9269df96105dff5ecc137b598ac7664d218ac6be (patch) | |
tree | 388409bbe67fafc18e79ae49a394643636e0711b /git-gui/git-gui.sh | |
parent | be510cfef3d8344007bd34128ca6eb799b714c8c (diff) | |
parent | 3849bfba84fb5b0e9d46920f62105b4e1dd97e63 (diff) | |
download | git-9269df96105dff5ecc137b598ac7664d218ac6be.tar.gz |
Merge branch 'maint' of git://repo.or.cz/git-gui into maint
* 'maint' of git://repo.or.cz/git-gui:
git-gui: Disable native platform text selection in "lists"
git-gui: Paper bag fix "Commit->Revert" format arguments
git-gui: Provide 'uninstall' Makefile target to undo an installation
git-gui: Font chooser to handle a large number of font families
git-gui: Make backporting changes from i18n version easier
git-gui: Don't delete send on Windows as it doesn't exist
git-gui: Trim trailing slashes from untracked submodule names
git-gui: Assume untracked directories are Git submodules
git-gui: handle "deleted symlink" diff marker
git-gui: show unstaged symlinks in diff viewer
git-gui: Avoid use of libdir in Makefile
git-gui: Disable Tk send in all git-gui sessions
git-gui: lib/index.tcl: handle files with % in the filename properly
git-gui: Properly set the state of "Stage/Unstage Hunk" action
git-gui: Fix detaching current branch during checkout
git-gui: Correct starting of git-remote to handle -w option
Diffstat (limited to 'git-gui/git-gui.sh')
-rwxr-xr-x | git-gui/git-gui.sh | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index fa30ccc5d6..f789e91b66 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -42,6 +42,8 @@ if {[catch {package require Tcl 8.4} err] exit 1 } +catch {rename send {}} ; # What an evil concept... + ###################################################################### ## ## enable verbose loading? @@ -62,6 +64,18 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} { ###################################################################### ## +## Fake internationalization to ease backporting of changes. + +proc mc {fmt args} { + set cmk [string first @@ $fmt] + if {$cmk > 0} { + set fmt [string range $fmt 0 [expr {$cmk - 1}]] + } + return [eval [list format $fmt] $args] +} + +###################################################################### +## ## read only globals set _appname [lindex [file split $argv0] end] @@ -261,7 +275,7 @@ proc _git_cmd {name} { set s [gets $f] close $f - switch -glob -- $s { + switch -glob -- [lindex $s 0] { #!*sh { set i sh } #!*perl { set i perl } #!*python { set i python } @@ -275,7 +289,7 @@ proc _git_cmd {name} { if {$interp eq {}} { error "git-$name requires $i (not in PATH)" } - set v [list $interp $p] + set v [concat [list $interp] [lrange $s 1 end] [list $p]] } else { # Assume it is builtin to git somehow and we # aren't actually able to see a file for it. @@ -467,6 +481,16 @@ proc tk_optionMenu {w varName args} { return $m } +proc rmsel_tag {text} { + $text tag conf sel \ + -background [$text cget -background] \ + -foreground [$text cget -foreground] \ + -borderwidth 0 + $text tag conf in_sel -background lightgray + bind $text <Motion> break + return $text +} + ###################################################################### ## ## find git @@ -1008,7 +1032,11 @@ proc read_ls_others {fd after} { set pck [split $buf_rlo "\0"] set buf_rlo [lindex $pck end] foreach p [lrange $pck 0 end-1] { - merge_state [encoding convertfrom $p] ?O + set p [encoding convertfrom $p] + if {[string index $p end] eq {/}} { + set p [string range $p 0 end-1] + } + merge_state $p ?O } rescan_done $fd buf_rlo $after } @@ -2133,8 +2161,8 @@ pack $ui_workdir -side left -fill both -expand 1 .vpane.files add .vpane.files.workdir -sticky nsew foreach i [list $ui_index $ui_workdir] { - $i tag conf in_diff -background lightgray - $i tag conf in_sel -background lightgray + rmsel_tag $i + $i tag conf in_diff -background [$i tag cget in_sel -background] } unset i @@ -2441,20 +2469,17 @@ proc popup_diff_menu {ctxm x y X Y} { set ::cursorX $x set ::cursorY $y if {$::ui_index eq $::current_diff_side} { - set s normal set l "Unstage Hunk From Commit" } else { - if {$current_diff_path eq {} - || ![info exists file_states($current_diff_path)] - || {_O} eq [lindex $file_states($current_diff_path) 0]} { - set s disabled - } else { - set s normal - } set l "Stage Hunk For Commit" } - if {$::is_3way_diff} { + if {$::is_3way_diff + || $current_diff_path eq {} + || ![info exists file_states($current_diff_path)] + || {_O} eq [lindex $file_states($current_diff_path) 0]} { set s disabled + } else { + set s normal } $ctxm entryconf $::ui_diff_applyhunk -state $s -label $l tk_popup $ctxm $X $Y |