Skip to content

Commit

Permalink
Sync with 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gitster committed Dec 18, 2024
2 parents fc95a5a + d882f38 commit d491657
Show file tree
Hide file tree
Showing 2 changed files with 439 additions and 381 deletions.
86 changes: 62 additions & 24 deletions gitk-git/gitk
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,10 @@ proc confirm_popup {msg {owner .}} {
return $confirm_ok
}

proc haveselectionclipboard {} {
return [expr {[tk windowingsystem] eq "x11"}]
}

proc setoptions {} {
global use_ttk

Expand Down Expand Up @@ -2089,7 +2093,7 @@ proc makewindow {} {
global diffcontextstring diffcontext
global ignorespace
global maincursor textcursor curtextcursor
global rowctxmenu fakerowmenu mergemax wrapcomment
global rowctxmenu fakerowmenu mergemax wrapcomment wrapdefault
global highlight_files gdttype
global searchstring sstring
global bgcolor fgcolor bglist fglist diffcolors diffbgcolors selectbgcolor
Expand Down Expand Up @@ -2223,7 +2227,7 @@ proc makewindow {} {
set sha1entry .tf.bar.sha1
set entries $sha1entry
set sha1but .tf.bar.sha1label
button $sha1but -text "[mc "SHA1 ID:"] " -state disabled -relief flat \
button $sha1but -text "[mc "Commit ID:"] " -state disabled -relief flat \
-command gotocommit -width 8
$sha1but conf -disabledforeground [$sha1but cget -foreground]
pack .tf.bar.sha1label -side left
Expand Down Expand Up @@ -2431,7 +2435,7 @@ proc makewindow {} {
set ctext .bleft.bottom.ctext
text $ctext -background $bgcolor -foreground $fgcolor \
-state disabled -undo 0 -font textfont \
-yscrollcommand scrolltext -wrap none \
-yscrollcommand scrolltext -wrap $wrapdefault \
-xscrollcommand ".bleft.bottom.sbhorizontal set"
if {$have_tk85} {
$ctext conf -tabstyle wordprocessor
Expand Down Expand Up @@ -7344,7 +7348,7 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
global mergemax numcommits pending_select
global cmitmode showneartags allcommits
global targetrow targetid lastscrollrows
global autoselect autosellen jump_to_here
global autocopy autoselect autosellen jump_to_here
global vinlinediff

unset -nocomplain pending_select
Expand Down Expand Up @@ -7410,9 +7414,13 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {

$sha1entry delete 0 end
$sha1entry insert 0 $id
if {$autoselect} {
if {$autoselect && [haveselectionclipboard]} {
$sha1entry selection range 0 $autosellen
}
if {$autocopy} {
clipboard clear
clipboard append [string range $id 0 [expr $autosellen - 1]]
}
rhighlight_sel $id

$ctext conf -state normal
Expand Down Expand Up @@ -8756,7 +8764,7 @@ proc sha1change {n1 n2 op} {
if {$state == "normal"} {
$sha1but conf -state normal -relief raised -text "[mc "Goto:"] "
} else {
$sha1but conf -state disabled -relief flat -text "[mc "SHA1 ID:"] "
$sha1but conf -state disabled -relief flat -text "[mc "Commit ID:"] "
}
}

Expand All @@ -8775,7 +8783,7 @@ proc gotocommit {} {
set matches [longid $id]
if {$matches ne {}} {
if {[llength $matches] > 1} {
error_popup [mc "Short SHA1 id %s is ambiguous" $id]
error_popup [mc "Short commit ID %s is ambiguous" $id]
return
}
set id [lindex $matches 0]
Expand All @@ -8792,7 +8800,7 @@ proc gotocommit {} {
return
}
if {[regexp {^[0-9a-fA-F]{4,}$} $sha1string]} {
set msg [mc "SHA1 id %s is not known" $sha1string]
set msg [mc "Commit ID %s is not known" $sha1string]
} else {
set msg [mc "Revision %s is not in the current view" $sha1string]
}
Expand Down Expand Up @@ -11576,12 +11584,13 @@ proc create_prefs_page {w} {

proc prefspage_general {notebook} {
global NS maxwidth maxgraphpct showneartags showlocalchanges
global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
global tabstop wrapcomment wrapdefault limitdiffs
global autocopy autoselect autosellen extdifftool perfile_attrs
global hideremotes want_ttk have_ttk maxrefs web_browser

set page [create_prefs_page $notebook.general]

${NS}::label $page.ldisp -text [mc "Commit list display options"]
${NS}::label $page.ldisp -text [mc "Commit list display options"] -font mainfontbold
grid $page.ldisp - -sticky w -pady 10
${NS}::label $page.spacer -text " "
${NS}::label $page.maxwidthl -text [mc "Maximum graph width (lines)"]
Expand All @@ -11594,19 +11603,38 @@ proc prefspage_general {notebook} {
${NS}::checkbutton $page.showlocal -text [mc "Show local changes"] \
-variable showlocalchanges
grid x $page.showlocal -sticky w
${NS}::checkbutton $page.autoselect -text [mc "Auto-select SHA1 (length)"] \
-variable autoselect
spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
grid x $page.autoselect $page.autosellen -sticky w
${NS}::checkbutton $page.hideremotes -text [mc "Hide remote refs"] \
-variable hideremotes
grid x $page.hideremotes -sticky w

${NS}::label $page.ddisp -text [mc "Diff display options"]
${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \
-variable autocopy
grid x $page.autocopy -sticky w
if {[haveselectionclipboard]} {
${NS}::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \
-variable autoselect
grid x $page.autoselect -sticky w
}
spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
${NS}::label $page.autosellenl -text [mc "Length of commit ID to copy"]
grid x $page.autosellenl $page.autosellen -sticky w

${NS}::label $page.ddisp -text [mc "Diff display options"] -font mainfontbold
grid $page.ddisp - -sticky w -pady 10
${NS}::label $page.tabstopl -text [mc "Tab spacing"]
spinbox $page.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
grid x $page.tabstopl $page.tabstop -sticky w

${NS}::label $page.wrapcommentl -text [mc "Wrap comment text"]
${NS}::combobox $page.wrapcomment -values {none char word} -state readonly \
-textvariable wrapcomment
grid x $page.wrapcommentl $page.wrapcomment -sticky w

${NS}::label $page.wrapdefaultl -text [mc "Wrap other text"]
${NS}::combobox $page.wrapdefault -values {none char word} -state readonly \
-textvariable wrapdefault
grid x $page.wrapdefaultl $page.wrapdefault -sticky w

${NS}::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \
-variable showneartags
grid x $page.ntag -sticky w
Expand Down Expand Up @@ -11635,7 +11663,7 @@ proc prefspage_general {notebook} {
pack configure $page.webbrowserf.l -padx 10
grid x $page.webbrowserf $page.webbrowser -sticky ew

${NS}::label $page.lgen -text [mc "General options"]
${NS}::label $page.lgen -text [mc "General options"] -font mainfontbold
grid $page.lgen - -sticky w -pady 10
${NS}::checkbutton $page.want_ttk -variable want_ttk \
-text [mc "Use themed widgets"]
Expand All @@ -11654,7 +11682,7 @@ proc prefspage_colors {notebook} {

set page [create_prefs_page $notebook.colors]

${NS}::label $page.cdisp -text [mc "Colors: press to choose"]
${NS}::label $page.cdisp -text [mc "Colors: press to choose"] -font mainfontbold
grid $page.cdisp - -sticky w -pady 10
label $page.ui -padx 40 -relief sunk -background $uicolor
${NS}::button $page.uibut -text [mc "Interface"] \
Expand Down Expand Up @@ -11712,7 +11740,7 @@ proc prefspage_colors {notebook} {
proc prefspage_fonts {notebook} {
global NS
set page [create_prefs_page $notebook.fonts]
${NS}::label $page.cfont -text [mc "Fonts: press to choose"]
${NS}::label $page.cfont -text [mc "Fonts: press to choose"] -font mainfontbold
grid $page.cfont - -sticky w -pady 10
mkfontdisp mainfont $page [mc "Main font"]
mkfontdisp textfont $page [mc "Diff display font"]
Expand All @@ -11725,7 +11753,7 @@ proc doprefs {} {
global oldprefs prefstop showneartags showlocalchanges
global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
global hideremotes want_ttk have_ttk
global hideremotes want_ttk have_ttk wrapcomment wrapdefault

set top .gitkprefs
set prefstop $top
Expand All @@ -11734,7 +11762,7 @@ proc doprefs {} {
return
}
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} {
set oldprefs($v) [set $v]
}
ttk_toplevel $top
Expand Down Expand Up @@ -11860,7 +11888,7 @@ proc prefscan {} {
global oldprefs prefstop

foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault} {
global $v
set $v $oldprefs($v)
}
Expand All @@ -11874,7 +11902,8 @@ proc prefsok {} {
global oldprefs prefstop showneartags showlocalchanges
global fontpref mainfont textfont uifont
global limitdiffs treediffs perfile_attrs
global hideremotes
global hideremotes wrapcomment wrapdefault
global ctext

catch {destroy $prefstop}
unset prefstop
Expand Down Expand Up @@ -11923,6 +11952,12 @@ proc prefsok {} {
if {$hideremotes != $oldprefs(hideremotes)} {
rereadrefs
}
if {$wrapcomment != $oldprefs(wrapcomment)} {
$ctext tag conf comment -wrap $wrapcomment
}
if {$wrapdefault != $oldprefs(wrapdefault)} {
$ctext configure -wrap $wrapdefault
}
}

proc formatdate {d} {
Expand Down Expand Up @@ -12392,6 +12427,7 @@ set downarrowlen 5
set mingaplen 100
set cmitmode "patch"
set wrapcomment "none"
set wrapdefault "none"
set showneartags 1
set hideremotes 0
set maxrefs 20
Expand All @@ -12400,6 +12436,7 @@ set maxlinelen 200
set showlocalchanges 1
set limitdiffs 1
set datetimeformat "%Y-%m-%d %H:%M:%S"
set autocopy 0
set autoselect 1
set autosellen 40
set perfile_attrs 0
Expand Down Expand Up @@ -12497,7 +12534,8 @@ config_check_tmp_exists 50

set config_variables {
mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth
cmitmode wrapcomment autoselect autosellen showneartags maxrefs visiblerefs
cmitmode wrapcomment wrapdefault autocopy autoselect autosellen
showneartags maxrefs visiblerefs
hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk
bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors
markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor
Expand Down Expand Up @@ -12687,7 +12725,7 @@ catch {
wm iconphoto . -default gitlogo gitlogo32
}
# wait for the window to become visible
tkwait visibility .
if {![winfo viewable .]} {tkwait visibility .}
set_window_title
update
readrefs
Expand Down
Loading

0 comments on commit d491657

Please sign in to comment.