@@ -2104,6 +2104,10 @@ proc confirm_popup {msg {owner .}} {
2104
2104
return $confirm_ok
2105
2105
}
2106
2106
2107
+ proc haveselectionclipboard {} {
2108
+ return [ expr {[tk windowingsystem] eq " x11" }]
2109
+ }
2110
+
2107
2111
proc setoptions {} {
2108
2112
global use_ttk
2109
2113
@@ -2224,7 +2228,7 @@ proc makewindow {} {
2224
2228
global diffcontextstring diffcontext
2225
2229
global ignorespace
2226
2230
global maincursor textcursor curtextcursor
2227
- global rowctxmenu fakerowmenu mergemax wrapcomment
2231
+ global rowctxmenu fakerowmenu mergemax wrapcomment wrapdefault
2228
2232
global highlight_files gdttype
2229
2233
global searchstring sstring
2230
2234
global bgcolor fgcolor bglist fglist diffcolors diffbgcolors selectbgcolor
@@ -2358,7 +2362,7 @@ proc makewindow {} {
2358
2362
set sha1entry .tf.bar.sha1
2359
2363
set entries $sha1entry
2360
2364
set sha1but .tf.bar.sha1label
2361
- button $sha1but -text " [mc " SHA1 ID:" ] " -state disabled -relief flat \
2365
+ button $sha1but -text " [mc " Commit ID:" ] " -state disabled -relief flat \
2362
2366
-command gotocommit -width 8
2363
2367
$sha1but conf -disabledforeground [ $sha1but cget -foreground]
2364
2368
pack .tf.bar.sha1label -side left
@@ -2566,7 +2570,7 @@ proc makewindow {} {
2566
2570
set ctext .bleft.bottom.ctext
2567
2571
text $ctext -background $bgcolor -foreground $fgcolor \
2568
2572
-state disabled -undo 0 -font textfont \
2569
- -yscrollcommand scrolltext -wrap none \
2573
+ -yscrollcommand scrolltext -wrap $wrapdefault \
2570
2574
-xscrollcommand " .bleft.bottom.sbhorizontal set"
2571
2575
if {$have_tk85 } {
2572
2576
$ctext conf -tabstyle wordprocessor
@@ -7484,7 +7488,7 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
7484
7488
global mergemax numcommits pending_select
7485
7489
global cmitmode showneartags allcommits
7486
7490
global targetrow targetid lastscrollrows
7487
- global autoselect autosellen jump_to_here
7491
+ global autocopy autoselect autosellen jump_to_here
7488
7492
global vinlinediff
7489
7493
7490
7494
unset -nocomplain pending_select
@@ -7550,9 +7554,13 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
7550
7554
7551
7555
$sha1entry delete 0 end
7552
7556
$sha1entry insert 0 $id
7553
- if {$autoselect } {
7557
+ if {$autoselect && [ haveselectionclipboard ] } {
7554
7558
$sha1entry selection range 0 $autosellen
7555
7559
}
7560
+ if {$autocopy } {
7561
+ clipboard clear
7562
+ clipboard append [ string range $id 0 [expr $autosellen - 1] ]
7563
+ }
7556
7564
rhighlight_sel $id
7557
7565
7558
7566
$ctext conf -state normal
@@ -8897,7 +8905,7 @@ proc sha1change {n1 n2 op} {
8897
8905
if {$state == " normal" } {
8898
8906
$sha1but conf -state normal -relief raised -text " [mc " Goto:" ] "
8899
8907
} else {
8900
- $sha1but conf -state disabled -relief flat -text " [mc " SHA1 ID:" ] "
8908
+ $sha1but conf -state disabled -relief flat -text " [mc " Commit ID:" ] "
8901
8909
}
8902
8910
}
8903
8911
@@ -8916,7 +8924,7 @@ proc gotocommit {} {
8916
8924
set matches [ longid $id ]
8917
8925
if {$matches ne {}} {
8918
8926
if {[ llength $matches ] > 1} {
8919
- error_popup [ mc " Short SHA1 id %s is ambiguous" $id ]
8927
+ error_popup [ mc " Short commit ID %s is ambiguous" $id ]
8920
8928
return
8921
8929
}
8922
8930
set id [ lindex $matches 0]
@@ -8933,7 +8941,7 @@ proc gotocommit {} {
8933
8941
return
8934
8942
}
8935
8943
if {[ regexp {^[0-9a-fA-F]{4,}$} $sha1string ] } {
8936
- set msg [ mc " SHA1 id %s is not known" $sha1string ]
8944
+ set msg [ mc " Commit ID %s is not known" $sha1string ]
8937
8945
} else {
8938
8946
set msg [ mc " Revision %s is not in the current view" $sha1string ]
8939
8947
}
@@ -11717,12 +11725,13 @@ proc create_prefs_page {w} {
11717
11725
11718
11726
proc prefspage_general {notebook} {
11719
11727
global NS maxwidth maxgraphpct showneartags showlocalchanges
11720
- global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
11728
+ global tabstop wrapcomment wrapdefault limitdiffs
11729
+ global autocopy autoselect autosellen extdifftool perfile_attrs
11721
11730
global hideremotes want_ttk have_ttk maxrefs web_browser
11722
11731
11723
11732
set page [ create_prefs_page $notebook .general]
11724
11733
11725
- ${NS} ::label $page .ldisp -text [ mc " Commit list display options" ]
11734
+ ${NS} ::label $page .ldisp -text [ mc " Commit list display options" ] -font mainfontbold
11726
11735
grid $page .ldisp - -sticky w -pady 10
11727
11736
${NS} ::label $page .spacer -text " "
11728
11737
${NS} ::label $page .maxwidthl -text [ mc " Maximum graph width (lines)" ]
@@ -11735,19 +11744,38 @@ proc prefspage_general {notebook} {
11735
11744
${NS} ::checkbutton $page .showlocal -text [ mc " Show local changes" ] \
11736
11745
-variable showlocalchanges
11737
11746
grid x $page .showlocal -sticky w
11738
- ${NS} ::checkbutton $page .autoselect -text [ mc " Auto-select SHA1 (length)" ] \
11739
- -variable autoselect
11740
- spinbox $page .autosellen -from 1 -to 40 -width 4 -textvariable autosellen
11741
- grid x $page .autoselect $page .autosellen -sticky w
11742
11747
${NS} ::checkbutton $page .hideremotes -text [ mc " Hide remote refs" ] \
11743
11748
-variable hideremotes
11744
11749
grid x $page .hideremotes -sticky w
11745
11750
11746
- ${NS} ::label $page .ddisp -text [ mc " Diff display options" ]
11751
+ ${NS} ::checkbutton $page .autocopy -text [ mc " Copy commit ID to clipboard" ] \
11752
+ -variable autocopy
11753
+ grid x $page .autocopy -sticky w
11754
+ if {[ haveselectionclipboard] } {
11755
+ ${NS} ::checkbutton $page .autoselect -text [ mc " Copy commit ID to X11 selection" ] \
11756
+ -variable autoselect
11757
+ grid x $page .autoselect -sticky w
11758
+ }
11759
+ spinbox $page .autosellen -from 1 -to 40 -width 4 -textvariable autosellen
11760
+ ${NS} ::label $page .autosellenl -text [ mc " Length of commit ID to copy" ]
11761
+ grid x $page .autosellenl $page .autosellen -sticky w
11762
+
11763
+ ${NS} ::label $page .ddisp -text [ mc " Diff display options" ] -font mainfontbold
11747
11764
grid $page .ddisp - -sticky w -pady 10
11748
11765
${NS} ::label $page .tabstopl -text [ mc " Tab spacing" ]
11749
11766
spinbox $page .tabstop -from 1 -to 20 -width 4 -textvariable tabstop
11750
11767
grid x $page .tabstopl $page .tabstop -sticky w
11768
+
11769
+ ${NS} ::label $page .wrapcommentl -text [ mc " Wrap comment text" ]
11770
+ ${NS} ::combobox $page .wrapcomment -values {none char word} -state readonly \
11771
+ -textvariable wrapcomment
11772
+ grid x $page .wrapcommentl $page .wrapcomment -sticky w
11773
+
11774
+ ${NS} ::label $page .wrapdefaultl -text [ mc " Wrap other text" ]
11775
+ ${NS} ::combobox $page .wrapdefault -values {none char word} -state readonly \
11776
+ -textvariable wrapdefault
11777
+ grid x $page .wrapdefaultl $page .wrapdefault -sticky w
11778
+
11751
11779
${NS} ::checkbutton $page .ntag -text [ mc " Display nearby tags/heads" ] \
11752
11780
-variable showneartags
11753
11781
grid x $page .ntag -sticky w
@@ -11776,7 +11804,7 @@ proc prefspage_general {notebook} {
11776
11804
pack configure $page .webbrowserf.l -padx 10
11777
11805
grid x $page .webbrowserf $page .webbrowser -sticky ew
11778
11806
11779
- ${NS} ::label $page .lgen -text [ mc " General options" ]
11807
+ ${NS} ::label $page .lgen -text [ mc " General options" ] -font mainfontbold
11780
11808
grid $page .lgen - -sticky w -pady 10
11781
11809
${NS} ::checkbutton $page .want_ttk -variable want_ttk \
11782
11810
-text [ mc " Use themed widgets" ]
@@ -11795,7 +11823,7 @@ proc prefspage_colors {notebook} {
11795
11823
11796
11824
set page [ create_prefs_page $notebook .colors]
11797
11825
11798
- ${NS} ::label $page .cdisp -text [ mc " Colors: press to choose" ]
11826
+ ${NS} ::label $page .cdisp -text [ mc " Colors: press to choose" ] -font mainfontbold
11799
11827
grid $page .cdisp - -sticky w -pady 10
11800
11828
label $page .ui -padx 40 -relief sunk -background $uicolor
11801
11829
${NS} ::button $page .uibut -text [ mc " Interface" ] \
@@ -11853,7 +11881,7 @@ proc prefspage_colors {notebook} {
11853
11881
proc prefspage_fonts {notebook} {
11854
11882
global NS
11855
11883
set page [ create_prefs_page $notebook .fonts]
11856
- ${NS} ::label $page .cfont -text [ mc " Fonts: press to choose" ]
11884
+ ${NS} ::label $page .cfont -text [ mc " Fonts: press to choose" ] -font mainfontbold
11857
11885
grid $page .cfont - -sticky w -pady 10
11858
11886
mkfontdisp mainfont $page [ mc " Main font" ]
11859
11887
mkfontdisp textfont $page [ mc " Diff display font" ]
@@ -11866,7 +11894,7 @@ proc doprefs {} {
11866
11894
global oldprefs prefstop showneartags showlocalchanges
11867
11895
global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
11868
11896
global tabstop limitdiffs autoselect autosellen extdifftool perfile_attrs
11869
- global hideremotes want_ttk have_ttk
11897
+ global hideremotes want_ttk have_ttk wrapcomment wrapdefault
11870
11898
11871
11899
set top .gitkprefs
11872
11900
set prefstop $top
@@ -11875,7 +11903,7 @@ proc doprefs {} {
11875
11903
return
11876
11904
}
11877
11905
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
11878
- limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
11906
+ limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault } {
11879
11907
set oldprefs($v ) [ set $v ]
11880
11908
}
11881
11909
ttk_toplevel $top
@@ -12001,7 +12029,7 @@ proc prefscan {} {
12001
12029
global oldprefs prefstop
12002
12030
12003
12031
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
12004
- limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
12032
+ limitdiffs tabstop perfile_attrs hideremotes want_ttk wrapcomment wrapdefault } {
12005
12033
global $v
12006
12034
set $v $oldprefs($v)
12007
12035
}
@@ -12015,7 +12043,8 @@ proc prefsok {} {
12015
12043
global oldprefs prefstop showneartags showlocalchanges
12016
12044
global fontpref mainfont textfont uifont
12017
12045
global limitdiffs treediffs perfile_attrs
12018
- global hideremotes
12046
+ global hideremotes wrapcomment wrapdefault
12047
+ global ctext
12019
12048
12020
12049
catch {destroy $prefstop }
12021
12050
unset prefstop
@@ -12064,6 +12093,12 @@ proc prefsok {} {
12064
12093
if {$hideremotes != $oldprefs(hideremotes) } {
12065
12094
rereadrefs
12066
12095
}
12096
+ if {$wrapcomment != $oldprefs(wrapcomment) } {
12097
+ $ctext tag conf comment -wrap $wrapcomment
12098
+ }
12099
+ if {$wrapdefault != $oldprefs(wrapdefault) } {
12100
+ $ctext configure -wrap $wrapdefault
12101
+ }
12067
12102
}
12068
12103
12069
12104
proc formatdate {d} {
@@ -12532,6 +12567,7 @@ set downarrowlen 5
12532
12567
set mingaplen 100
12533
12568
set cmitmode " patch"
12534
12569
set wrapcomment " none"
12570
+ set wrapdefault " none"
12535
12571
set showneartags 1
12536
12572
set hideremotes 0
12537
12573
set maxrefs 20
@@ -12540,6 +12576,7 @@ set maxlinelen 200
12540
12576
set showlocalchanges 1
12541
12577
set limitdiffs 1
12542
12578
set datetimeformat " %Y-%m-%d %H:%M:%S"
12579
+ set autocopy 0
12543
12580
set autoselect 1
12544
12581
set autosellen 40
12545
12582
set perfile_attrs 0
@@ -12637,7 +12674,8 @@ config_check_tmp_exists 50
12637
12674
12638
12675
set config_variables {
12639
12676
mainfont textfont uifont tabstop findmergefiles maxgraphpct maxwidth
12640
- cmitmode wrapcomment autoselect autosellen showneartags maxrefs visiblerefs
12677
+ cmitmode wrapcomment wrapdefault autocopy autoselect autosellen
12678
+ showneartags maxrefs visiblerefs
12641
12679
hideremotes showlocalchanges datetimeformat limitdiffs uicolor want_ttk
12642
12680
bgcolor fgcolor uifgcolor uifgdisabledcolor colors diffcolors mergecolors
12643
12681
markbgcolor diffcontext selectbgcolor foundbgcolor currentsearchhitbgcolor
@@ -12832,7 +12870,7 @@ if {$::tcl_platform(platform) eq {windows} && [file exists $gitk_prefix/etc/git.
12832
12870
}
12833
12871
}
12834
12872
# wait for the window to become visible
12835
- tkwait visibility .
12873
+ if {! [ winfo viewable . ] } { tkwait visibility .}
12836
12874
set_window_title
12837
12875
update
12838
12876
readrefs
0 commit comments