]> asedeno.scripts.mit.edu Git - git.git/blobdiff - lib/blame.tcl
git-gui: Support the encoding menu in gui blame.
[git.git] / lib / blame.tcl
index 7535adb97de1ab374034e95fe590380dd7c7a626..eb61374d2db79a1199d455dfdda85e2d063bf1f6 100644 (file)
@@ -256,9 +256,16 @@ constructor new {i_commit i_path i_jump} {
        $w.ctxm add command \
                -label [mc "Copy Commit"] \
                -command [cb _copycommit]
+       $w.ctxm add separator
+       menu $w.ctxm.enc
+       build_encoding_menu $w.ctxm.enc [cb _setencoding]
+       $w.ctxm add cascade \
+               -label [mc "Encoding"] \
+               -menu $w.ctxm.enc
        $w.ctxm add command \
                -label [mc "Do Full Copy Detection"] \
                -command [cb _fullcopyblame]
+       $w.ctxm add separator
        $w.ctxm add command \
                -label [mc "Show History Context"] \
                -command [cb _gitkcommit]
@@ -402,7 +409,7 @@ method _load {jump} {
        fconfigure $fd \
                -blocking 0 \
                -translation lf \
-               -encoding [tcl_encoding [gitattr $path encoding UTF-8]]
+               -encoding [get_path_encoding $path]
        fileevent $fd readable [cb _read_file $fd $jump]
        set current_fd $fd
 }
@@ -791,6 +798,16 @@ method _click {cur_w pos} {
        _showcommit $this $cur_w $lno
 }
 
+method _setencoding {enc} {
+       force_path_encoding $path $enc
+       _load $this [list \
+               $highlight_column \
+               $highlight_line \
+               [lindex [$w_file xview] 0] \
+               [lindex [$w_file yview] 0] \
+               ]
+}
+
 method _load_commit {cur_w cur_d pos} {
        upvar #0 $cur_d line_data
        set lno [lindex [split [$cur_w index $pos] .] 0]