1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-04-20 09:14:07 +02:00
* https://github.com/prati0100/git-gui:
  git-gui: use gray background for inactive text widgets
  git-gui: Fix selected text colors
  Makefile: conditionally include GIT-VERSION-FILE
  git-gui: fix colored label backgrounds when using themed widgets
  git-gui: ssh-askpass: add a checkbox to show the input text
  git-gui: update Russian translation
  git-gui: use commit message template
  git-gui: Only touch GITGUI_MSG when needed
This commit is contained in:
Junio C Hamano 2020-12-18 15:07:10 -08:00
commit f4d8e19123
6 changed files with 1883 additions and 1569 deletions

View File

@ -9,7 +9,9 @@ all::
GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
ifneq ($(MAKECMDGOALS),clean)
-include GIT-VERSION-FILE
endif
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')

View File

@ -26,8 +26,21 @@ pack .m -side top -fill x -padx 20 -pady 20 -expand 1
entry .e -textvariable answer -width 50
pack .e -side top -fill x -padx 10 -pady 10
proc on_show_input_changed {args} {
global show_input
if {$show_input} {
.e configure -show ""
} else {
.e configure -show "*"
}
}
trace add variable show_input write "on_show_input_changed"
set show_input 0
if {!$yesno} {
.e configure -show "*"
checkbutton .cb_show -text "Show input" -variable show_input
pack .cb_show -side top -anchor nw
}
frame .b

View File

@ -720,9 +720,6 @@ proc rmsel_tag {text} {
-background [$text cget -background] \
-foreground [$text cget -foreground] \
-borderwidth 0
$text tag conf in_sel\
-background $color::select_bg \
-foreground $color::select_fg
bind $text <Motion> break
return $text
}
@ -1482,6 +1479,7 @@ proc rescan {after {honor_trustmtime 1}} {
} elseif {[run_prepare_commit_msg_hook]} {
} elseif {[load_message MERGE_MSG]} {
} elseif {[load_message SQUASH_MSG]} {
} elseif {[load_message [get_config commit.template]]} {
}
$ui_comm edit reset
$ui_comm edit modified false
@ -1616,6 +1614,12 @@ proc run_prepare_commit_msg_hook {} {
fconfigure $fd_sm -encoding utf-8
puts -nonewline $fd_pcm [read $fd_sm]
close $fd_sm
} elseif {[file isfile [get_config commit.template]]} {
set pcm_source "template"
set fd_sm [open [get_config commit.template] r]
fconfigure $fd_sm -encoding utf-8
puts -nonewline $fd_pcm [read $fd_sm]
close $fd_sm
} else {
set pcm_source ""
}
@ -2305,11 +2309,10 @@ proc do_quit {{rc {1}}} {
if {$GITGUI_BCK_exists && ![$ui_comm edit modified]} {
file rename -force [gitdir GITGUI_BCK] $save
set GITGUI_BCK_exists 0
} else {
} elseif {[$ui_comm edit modified]} {
set msg [string trim [$ui_comm get 0.0 end]]
regsub -all -line {[ \r\t]+$} $msg {} msg
if {(![string match amend* $commit_type]
|| [$ui_comm edit modified])
if {![string match amend* $commit_type]
&& $msg ne {}} {
catch {
set fd [open $save w]
@ -3322,11 +3325,20 @@ if {!$use_ttk} {
.vpane.files paneconfigure .vpane.files.index -sticky news
}
proc set_selection_colors {w has_focus} {
foreach tag [list in_diff in_sel] {
$w tag conf $tag \
-background [expr {$has_focus ? $color::select_bg : $color::inactive_select_bg}] \
-foreground [expr {$has_focus ? $color::select_fg : $color::inactive_select_fg}]
}
}
foreach i [list $ui_index $ui_workdir] {
rmsel_tag $i
$i tag conf in_diff \
-background $color::select_bg \
-foreground $color::select_fg
set_selection_colors $i 0
bind $i <FocusIn> { set_selection_colors %W 1 }
bind $i <FocusOut> { set_selection_colors %W 0 }
}
unset i

View File

@ -456,6 +456,7 @@ A rescan will be automatically started now.
}
$ui_comm delete 0.0 end
load_message [get_config commit.template]
$ui_comm edit reset
$ui_comm edit modified false
if {$::GITGUI_BCK_exists} {

View File

@ -6,19 +6,25 @@ namespace eval color {
# Variable colors
# Preffered way to set widget colors is using add_option.
# In some cases, like with tags in_diff/in_sel, we use these colors.
variable select_bg lightgray
variable select_fg black
variable select_bg lightgray
variable select_fg black
variable inactive_select_bg lightgray
variable inactive_select_fg black
proc sync_with_theme {} {
set base_bg [ttk::style lookup . -background]
set base_fg [ttk::style lookup . -foreground]
set text_bg [ttk::style lookup Treeview -background]
set text_fg [ttk::style lookup Treeview -foreground]
set select_bg [ttk::style lookup Default -selectbackground]
set select_fg [ttk::style lookup Default -selectforeground]
set base_bg [ttk::style lookup . -background]
set base_fg [ttk::style lookup . -foreground]
set text_bg [ttk::style lookup Treeview -background]
set text_fg [ttk::style lookup Treeview -foreground]
set select_bg [ttk::style lookup Default -selectbackground]
set select_fg [ttk::style lookup Default -selectforeground]
set inactive_select_bg [convert_rgb_to_gray $select_bg]
set inactive_select_fg $select_fg
set color::select_bg $select_bg
set color::select_fg $select_fg
set color::inactive_select_bg $inactive_select_bg
set color::inactive_select_fg $inactive_select_fg
proc add_option {key val} {
option add $key $val widgetDefault
@ -34,11 +40,22 @@ namespace eval color {
}
add_option *Text.Background $text_bg
add_option *Text.Foreground $text_fg
add_option *Text.HighlightBackground $base_bg
add_option *Text.HighlightColor $select_bg
add_option *Text.selectBackground $select_bg
add_option *Text.selectForeground $select_fg
add_option *Text.inactiveSelectBackground $inactive_select_bg
add_option *Text.inactiveSelectForeground $inactive_select_fg
}
}
proc convert_rgb_to_gray {rgb} {
# Simply take the average of red, green and blue. This wouldn't be good
# enough for, say, converting a photo to grayscale, but for this simple
# purpose of approximating the brightness of a color it's good enough.
lassign [winfo rgb . $rgb] r g b
set gray [expr {($r / 256 + $g / 256 + $b / 256) / 3}]
return [format "#%2.2X%2.2X%2.2X" $gray $gray $gray]
}
proc ttk_get_current_theme {} {
# Handle either current Tk or older versions of 8.5
if {[catch {set theme [ttk::style theme use]}]} {
@ -174,7 +191,7 @@ proc InitEntryFrame {} {
proc gold_frame {w args} {
global use_ttk
if {$use_ttk} {
if {$use_ttk && ![is_MacOSX]} {
eval [linsert $args 0 ttk::frame $w -style Gold.TFrame]
} else {
eval [linsert $args 0 frame $w -background gold]
@ -183,7 +200,7 @@ proc gold_frame {w args} {
proc tlabel {w args} {
global use_ttk
if {$use_ttk} {
if {$use_ttk && ![is_MacOSX]} {
set cmd [list ttk::label $w -style Color.TLabel]
foreach {k v} $args {
switch -glob -- $k {

File diff suppressed because it is too large Load Diff