Skip to content

Commit e3e901b

Browse files
committed
gitk: Make the background color of marked lines configurable
This makes it possible for the user to configure the background color of lines that are "marked". At the moment only the "show the origin of this line" function marks lines. This also makes the user's choice persistent by saving it in ~/.gitk. Signed-off-by: Paul Mackerras <[email protected]>
1 parent 8a89774 commit e3e901b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

gitk

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ proc savestuff {w} {
24152415
global viewname viewfiles viewargs viewargscmd viewperm nextviewnum
24162416
global cmitmode wrapcomment datetimeformat limitdiffs
24172417
global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
2418-
global autoselect extdifftool perfile_attrs
2418+
global autoselect extdifftool perfile_attrs markbgcolor
24192419

24202420
if {$stuffsaved} return
24212421
if {![winfo viewable .]} return
@@ -2439,6 +2439,7 @@ proc savestuff {w} {
24392439
puts $f [list set fgcolor $fgcolor]
24402440
puts $f [list set colors $colors]
24412441
puts $f [list set diffcolors $diffcolors]
2442+
puts $f [list set markbgcolor $markbgcolor]
24422443
puts $f [list set diffcontext $diffcontext]
24432444
puts $f [list set selectbgcolor $selectbgcolor]
24442445
puts $f [list set extdifftool $extdifftool]
@@ -6658,11 +6659,11 @@ proc getblobline {bf id} {
66586659
}
66596660

66606661
proc mark_ctext_line {lnum} {
6661-
global ctext
6662+
global ctext markbgcolor
66626663

66636664
$ctext tag delete omark
66646665
$ctext tag add omark $lnum.0 "$lnum.0 + 1 line"
6665-
$ctext tag conf omark -background "#e0e0ff"
6666+
$ctext tag conf omark -background $markbgcolor
66666667
$ctext see $lnum.0
66676668
}
66686669

@@ -9731,7 +9732,7 @@ proc chg_fontparam {v sub op} {
97319732
proc doprefs {} {
97329733
global maxwidth maxgraphpct
97339734
global oldprefs prefstop showneartags showlocalchanges
9734-
global bgcolor fgcolor ctext diffcolors selectbgcolor
9735+
global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
97359736
global tabstop limitdiffs autoselect extdifftool perfile_attrs
97369737

97379738
set top .gitkprefs
@@ -9824,6 +9825,12 @@ proc doprefs {} {
98249825
"diff hunk header" \
98259826
[list $ctext tag conf hunksep -foreground]]
98269827
grid x $top.hunksepbut $top.hunksep -sticky w
9828+
label $top.markbgsep -padx 40 -relief sunk -background $markbgcolor
9829+
button $top.markbgbut -text [mc "Marked line bg"] -font optionfont \
9830+
-command [list choosecolor markbgcolor {} $top.markbgsep \
9831+
[mc "marked line background"] \
9832+
[list $ctext tag conf omark -background]]
9833+
grid x $top.markbgbut $top.markbgsep -sticky w
98279834
label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor
98289835
button $top.selbgbut -text [mc "Select bg"] -font optionfont \
98299836
-command [list choosecolor selectbgcolor {} $top.selbgsep background setselbg]
@@ -10369,6 +10376,7 @@ set diffcolors {red "#00a000" blue}
1036910376
set diffcontext 3
1037010377
set ignorespace 0
1037110378
set selectbgcolor gray85
10379+
set markbgcolor "#e0e0ff"
1037210380

1037310381
set circlecolors {white blue gray blue blue}
1037410382

0 commit comments

Comments
 (0)