gitk: Show the current view's name in the window title
If the current view is the "Command line" view, show the command line arguments instead of the view name. Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Marc Branchaud committed
Apr 7, 2015 at 11:51 UTC
9922c5a3340e77c7a3b199f25a49af5fdd7a5ef1
1 file changed
+16
-1
gitk
+16
-1
@@ -4036,6 +4036,19 @@ proc shellsplit {str} {
4036
return $l
4037
}
4038
4039
+proc set_window_title {} {
4040
+ global appname curview viewname vrevs
4041
+ set rev [mc "All files"]
4042
+ if {$curview ne 0} {
4043
+ if {$viewname($curview) eq [mc "Command line"]} {
4044
+ set rev [string map {"--gitk-symmetric-diff-marker" "--merge"} $vrevs($curview)]
4045
+ } else {
4046
+ set rev $viewname($curview)
4047
+ }
4048
+ }
4049
+ wm title . "[reponame]: $rev - $appname"
4050
+}
4051
+
4052
# Code to implement multiple views
4053
4054
proc newview {ishighlight} {
@@ -4512,6 +4525,7 @@ proc showview {n} {
4525
} elseif {$numcommits == 0} {
4526
show_status [mc "No commits selected"]
4527
}
4528
+ set_window_title
4529
}
4530
4531
# Stuff relating to the highlighting facility
@@ -6652,6 +6666,7 @@ proc show_status {msg} {
6666
global canv fgcolor
6667
6668
clear_display
6669
+ set_window_title
6670
$canv create text 3 3 -anchor nw -text $msg -font mainfont \
6671
-tags text -fill $fgcolor
6672
}
@@ -12403,7 +12418,7 @@ catch {
12418
}
12419
# wait for the window to become visible
12420
tkwait visibility .
12406
-wm title . "[reponame] - $appname"
12421
+set_window_title
12422
update
12423
readrefs
12424