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 <j6t@kdbg.org>
This commit is contained in:
14
gitk
14
gitk
@ -1969,6 +1969,10 @@ proc confirm_popup {msg {owner .}} {
|
|||||||
return $confirm_ok
|
return $confirm_ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc haveselectionclipboard {} {
|
||||||
|
return [expr {[tk windowingsystem] eq "x11"}]
|
||||||
|
}
|
||||||
|
|
||||||
proc setoptions {} {
|
proc setoptions {} {
|
||||||
global use_ttk
|
global use_ttk
|
||||||
|
|
||||||
@ -7410,7 +7414,7 @@ proc selectline {l isnew {desired_loc {}} {switch_to_patch 0}} {
|
|||||||
|
|
||||||
$sha1entry delete 0 end
|
$sha1entry delete 0 end
|
||||||
$sha1entry insert 0 $id
|
$sha1entry insert 0 $id
|
||||||
if {$autoselect} {
|
if {$autoselect && [haveselectionclipboard]} {
|
||||||
$sha1entry selection range 0 $autosellen
|
$sha1entry selection range 0 $autosellen
|
||||||
}
|
}
|
||||||
if {$autocopy} {
|
if {$autocopy} {
|
||||||
@ -11605,9 +11609,11 @@ proc prefspage_general {notebook} {
|
|||||||
${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \
|
${NS}::checkbutton $page.autocopy -text [mc "Copy commit ID to clipboard"] \
|
||||||
-variable autocopy
|
-variable autocopy
|
||||||
grid x $page.autocopy -sticky w
|
grid x $page.autocopy -sticky w
|
||||||
${NS}::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \
|
if {[haveselectionclipboard]} {
|
||||||
-variable autoselect
|
${NS}::checkbutton $page.autoselect -text [mc "Copy commit ID to X11 selection"] \
|
||||||
grid x $page.autoselect -sticky w
|
-variable autoselect
|
||||||
|
grid x $page.autoselect -sticky w
|
||||||
|
}
|
||||||
spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
|
spinbox $page.autosellen -from 1 -to 40 -width 4 -textvariable autosellen
|
||||||
${NS}::label $page.autosellenl -text [mc "Length of commit ID to copy"]
|
${NS}::label $page.autosellenl -text [mc "Length of commit ID to copy"]
|
||||||
grid x $page.autosellenl $page.autosellen -sticky w
|
grid x $page.autosellenl $page.autosellen -sticky w
|
||||||
|
Reference in New Issue
Block a user