git-gui: Support the encoding menu in gui blame.
Allow dynamically changing the encoding from the blame viewer as well. Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com> Tested-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Alexander Gavrilov committed
Sep 18, 2008 at 01:07 UTC
6fc835a3f36146006bb33362368cf9d314877e51
1 file changed
+17
lib/blame.tcl
+17
@@ -256,9 +256,16 @@ constructor new {i_commit i_path i_jump} {
256
$w.ctxm add command \
257
-label [mc "Copy Commit"] \
258
-command [cb _copycommit]
259
+ $w.ctxm add separator
260
+ menu $w.ctxm.enc
261
+ build_encoding_menu $w.ctxm.enc [cb _setencoding]
262
+ $w.ctxm add cascade \
263
+ -label [mc "Encoding"] \
264
+ -menu $w.ctxm.enc
265
$w.ctxm add command \
266
-label [mc "Do Full Copy Detection"] \
267
-command [cb _fullcopyblame]
268
+ $w.ctxm add separator
269
$w.ctxm add command \
270
-label [mc "Show History Context"] \
271
-command [cb _gitkcommit]
@@ -791,6 +798,16 @@ method _click {cur_w pos} {
798
_showcommit $this $cur_w $lno
799
}
800
801
+method _setencoding {enc} {
802
+ force_path_encoding $path $enc
803
+ _load $this [list \
804
+ $highlight_column \
805
+ $highlight_line \
806
+ [lindex [$w_file xview] 0] \
807
+ [lindex [$w_file yview] 0] \
808
+ ]
809
+}
810
+
811
method _load_commit {cur_w cur_d pos} {
812
upvar #0 $cur_d line_data
813
set lno [lindex [split [$cur_w index $pos] .] 0]