git-gui: Reverted file name text field to a label.
So although a text field with a flat relief looks like a label on
Windows it doesn't on Mac OS X. The Aqua version of Tk is still
drawing a border around the text field and that makes the diff pane
header look pretty ugly.
Earlier I had made the file name area into a text widget so the user
could highlight parts of it and copy them onto the clipboard; but with
the context menu being present this isn't quite as necessary as the user
can copy the file name to the clipboard using that instead. So although
this is a small loss in functionality for non-Mac OS X systems I think it
is still reasonable.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
diff --git a/git-gui b/git-gui
index fbbc0ca..ca7f8db 100755
--- a/git-gui
+++ b/git-gui
@@ -2290,33 +2290,23 @@
-background orange \
-font font_ui
set ui_fname .vpane.lower.diff.header.l2
-text $ui_fname \
+label $ui_fname \
+ -textvariable ui_fname_value \
-background orange \
- -height 1 \
- -wrap none \
- -relief flat \
- -state disabled \
+ -anchor w \
+ -justify left \
-font font_ui
menu $ui_fname.ctxm -tearoff 0
-$ui_fname.ctxm add command -label "Copy Only Selection" \
+$ui_fname.ctxm add command -label "Copy" \
-font font_ui \
- -command "tk_textCopy $ui_fname"
-$ui_fname.ctxm add command -label "Copy Complete Name" \
- -font font_ui \
- -command "
- $ui_fname tag add sel 0.0 {end -1c}
- tk_textCopy $ui_fname
- $ui_fname tag remove sel 0.0 end
- "
+ -command {
+ clipboard clear
+ clipboard append \
+ -format STRING \
+ -type STRING \
+ -- $ui_fname_value
+ }
bind_button3 $ui_fname "tk_popup $ui_fname.ctxm %X %Y"
-trace add variable ui_fname_value write $ui_fname.update
-proc $ui_fname.update {varname args} {
- global ui_fname ui_fname_value
- $ui_fname configure -state normal
- $ui_fname delete 0.0 end
- $ui_fname insert end [escape_path $ui_fname_value]
- $ui_fname configure -state disabled
-}
pack .vpane.lower.diff.header.l4 -side left
pack .vpane.lower.diff.header.l1 -side left
pack $ui_fname -fill x