Closed heppu closed 8 years ago
I applied some changes and pushed them to branch heppu-active. The most relevant ones are:
*Gui.SetRuneWithColor
with *Gui.SetRune
. I know it breaks the API, but we are in v0.3 and I feel it's better to put consistency first. For instance, this change makes *Gui.SetRune
consistent with *View.setRune
.*Gui.SetCurrentViewOnTop
. It forces you to loop twice over the views, but the performance penalty shouldn't be a problem (won't be called continuously) and it keeps the API simple.*Gui.SetCurrentView
returns (*View, error)
, just like *Gui.SetViewOnTop
._examples/dynamic.go
to use ActiveColor (I like it :D).What do you think?
Thanks a lot for your contribution!
Everything looks good to me. =)
@jroimartin I applied the changes to this merge request so that it can be merged.
@heppu I've merged the branch heppu-active
because I had already squashed your commits and it was easier to do fast-forward. I hope you don't mind :)
Not at all thanks for great library =)
Cool! Could you give a look at #63? It's kinda related :)
I've just realized that the original behaviour of *Gui.{FgColor,BgColor}
was modified. Originally, these fields were used to define the color of the GUI (frames), but with these changes it stopped working.
So, I pushed the following changes c0ae0719314996cfc7f888f87896b35b748aa3e2, a7019c85474edf609ada2c24805cbf1c91651f9c:
I think that using Gui.{SelFgColor,SelBgColor} to set current view's color is more consistent with View.{SelFgColor,SelBgColor}, which is used for line highlighting.
Add support for using different color for frame of currentView by new Attribute called ActiveColor. The behavior is similar to BgColor in Gui and View struct. By default the ActiveColor is set to ColorWhite so that everything looks same as without setting it.
For coloring frames without breaking the current API I added SetRuneWIthColor function which takes also the BG and FG colors as parameters. To fully benefit from this feature I added SetCurrentViewOnTop function which combines SetCurrentView and SetViewOnTop functions so that we don't need to loop views through twice. This is related to use case where the views are combined in tmux style, with shared frame lines.
_examples/activation.go demonstrates the usage of setting ActiveColor for Gui and View.