Skip to content

Commit 36625a6

Browse files
committed
gitk: offer "Copy commit ID to X11 selection" only on X11
This option is only useful where a selection clipboard is available, which is only the case on X11. Do not clutter the UI in other environments. Signed-off-by: Johannes Sixt <[email protected]>
1 parent d77c3e3 commit 36625a6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

gitk

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1969,6 +1969,10 @@ proc confirm_popup {msg {owner .}} {
19691969
return $confirm_ok
19701970
}
19711971

1972+
proc haveselectionclipboard {} {
1973+
return [expr {[tk windowingsystem] eq "x11"}]
1974+
}
1975+
19721976
proc setoptions {} {
19731977
global use_ttk
19741978

@@ -7410,7 +7414,7 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
74107414

74117415
$sha1entry delete 0 end
74127416
$sha1entry insert 0 $id
7413-
if {$autoselect} {
7417+
if {$autoselect && [haveselectionclipboard]} {
74147418
$sha1entry selection range 0 $autosellen
74157419
}
74167420
if {$autocopy} {
@@ -11605,9 +11609,11 @@ proc prefspage_general {notebook} {
1160511609
${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \
1160611610
-variable autocopy
1160711611
grid x $page.autocopy -sticky w
11608-
${NS}::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \
11609-
-variable autoselect
11610-
grid x $page.autoselect -sticky w
11612+
if {[haveselectionclipboard]} {
11613+
${NS}::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \
11614+
-variable autoselect
11615+
grid x $page.autoselect -sticky w
11616+
}
1161111617
spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
1161211618
${NS}::label $page.autosellenl -text [mc "Length of commit ID to copy"]
1161311619
grid x $page.autosellenl $page.autosellen -sticky w

0 commit comments

Comments
 (0)