Re: [PATCH] git-gui: use gray selection background for inactive text widgets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Mon, Nov 23, 2020 at 20:03, Stefan Haller <stefan@xxxxxxxxxxxxxxxx> wrote:
 +        bind $i <FocusIn> {
 +            foreach tag [list in_diff in_sel] {
 +                %W tag conf $tag \
 +                    -background $color::select_bg \
 +                    -foreground $color::select_fg
 +            }
 +        }
 +        bind $i <FocusOut> {
 +            foreach tag [list in_diff in_sel] {

 This two `foreach` can be combined into one?

I don't see how; any concrete suggestions? But I have other ideas how to simplify the code (by using one function set_selection_colors that takes
a has_focus bool and is used for both bindings).

I tried to do this, and now i understand why my suggestion was wrong, i was looking at this as "cycle inside cycle", but it's actually "cycle inside event handler".


 +                %W tag conf $tag \

 And this `%W`, probably should be `$i`?

No, $i wouldn't work because we're inside curly braces, so $i wouldn't
get expanded. It would be possible to work around this by using ""
instead of {}, but why? Using %W seems to be the idiomatic way in
bindings, we do this everywhere else too.

Oh, now i see it's used in the same way in other places!

> %W The path name of the window to which the event was reported (the window field from the event).

Now I understand it.






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux