Skip to content

Commit

Permalink
[gnoland] cmd test
Browse files Browse the repository at this point in the history
  • Loading branch information
jaekwon committed Feb 14, 2021
1 parent 7d75283 commit ba75a19
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
18 changes: 17 additions & 1 deletion data/gnoland/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ var root Node

type Node interface{}
type Key interface{}
type Value interface{}

type InnerNode struct {
Key Key
Left Node `gno:owned`
Right Node `gno:owned`
}

type LeafNode struct {
Key Key
Value Value
}

func init() {
root = InnerNode{
Key: "old",
Expand All @@ -19,8 +25,18 @@ func init() {

func main() {
println("gno.land initializing...")
node1 := LeafNode{
Key: "left",
Value: "left value",
}
node2 := LeafNode{
Key: "right",
Value: "right value",
}
root = InnerNode{
Key: "new",
Key: "new",
Left: node1,
Right: node2,
}
println("gno.land ready!")
}
2 changes: 1 addition & 1 deletion logos/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (cc *Cell) GetTCellContent() (mainc rune, combc []rune, tstyle tcell.Style)
if style == nil {
tstyle = gDefaultStyle.WithAttrs(attrs).GetTStyle()
} else {
tstyle = style.WithAttrs(attrs).GetTStyle2()
tstyle = style.WithAttrs(attrs).GetTStyle()
}
}
return
Expand Down
21 changes: 1 addition & 20 deletions logos/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ func DefaultStyle() *Style {

var gDefaultStyle = DefaultStyle()
var gDefaultForeground = tcell.ColorBlack
var gDefaultBackground = tcell.ColorWhite
var gDefaultBackground = tcell.ColorLightBlue

func (st *Style) Copy() *Style {
st2 := *st
Expand Down Expand Up @@ -596,25 +596,6 @@ func (st *Style) WithAttrs(attrs *Attrs) (res Style) {
return
}

func (st Style) GetTStyle2() (tst tcell.Style) {
if st.Foreground.Valid() {
tst = tst.Foreground(st.Foreground)
} else {
tst = tst.Foreground(gDefaultForeground)
}
if st.Background.Valid() {
tst = tst.Background(st.Background)
} else {
tst = tst.Background(tcell.ColorBlue)
}
if st.GetIsShaded() {
tst = tst.Dim(true)
tst = tst.Background(tcell.ColorGray)
}
// TODO StyleFlags
return tst
}

func (st Style) GetTStyle() (tst tcell.Style) {
if st.Foreground.Valid() {
tst = tst.Foreground(st.Foreground)
Expand Down

0 comments on commit ba75a19

Please sign in to comment.