Fix after merge. Remove compat.

pull/232/head
Simon Roberts 3 years ago
parent baeee67e64
commit 7e4ede0ab8
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4

@ -1,32 +0,0 @@
// Copyright 2014 The gocui Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gocui
import "github.com/cointop-sh/cointop/pkg/termbox"
// Attribute represents a terminal attribute, like color, font style, etc. They
// can be combined using bitwise OR (|). Note that it is not possible to
// combine multiple color attributes.
type Attribute termbox.Attribute
// Color attributes.
const (
ColorDefault Attribute = Attribute(termbox.ColorDefault)
ColorBlack = Attribute(termbox.ColorBlack)
ColorRed = Attribute(termbox.ColorRed)
ColorGreen = Attribute(termbox.ColorGreen)
ColorYellow = Attribute(termbox.ColorYellow)
ColorBlue = Attribute(termbox.ColorBlue)
ColorMagenta = Attribute(termbox.ColorMagenta)
ColorCyan = Attribute(termbox.ColorCyan)
ColorWhite = Attribute(termbox.ColorWhite)
)
// Text style attributes.
// const (
// AttrBold Attribute = Attribute(termbox.AttrBold)
// AttrUnderline = Attribute(termbox.AttrUnderline)
// AttrReverse = Attribute(termbox.AttrReverse)
// )

@ -493,10 +493,10 @@ func (g *Gui) fixColor(c tcell.Color) tcell.Color {
}
func (g *Gui) Style(fg, bg tcell.Color) tcell.Style {
st := tcell.StyleDefault.Foreground(fg).Background(bg)
return st
return tcell.StyleDefault.Foreground(fg).Background(bg)
}
/*
func (g *Gui) MkColor(color Attribute) tcell.Color {
if color == ColorDefault {
return tcell.ColorDefault
@ -531,6 +531,7 @@ func (g *Gui) MkStyle(fg, bg Attribute) tcell.Style {
return st
}
*/
// flush updates the gui, re-drawing frames and buffers.
func (g *Gui) flush() error {

@ -341,22 +341,13 @@ func (v *View) draw() error {
break
}
// fgColor := c.fgColor
// if fgColor == ColorDefault {
// fgColor = v.FgColor
// }
// bgColor := c.bgColor
// if bgColor == ColorDefault {
// bgColor = v.BgColor
// }
st := c.style
fgColor, bgColor, _ := c.style.Decompose()
if fgColor == tcell.ColorDefault {
st = st.Foreground(v.g.MkColor(v.FgColor))
st = st.Foreground(v.FgColor)
}
if bgColor == tcell.ColorDefault {
st = st.Background(v.g.MkColor(v.BgColor))
st = st.Background(v.BgColor)
}
if err := v.setRune(x, y, c.chr, st); err != nil {
return err

@ -1,103 +0,0 @@
// Copyright 2020 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
// You may obtain a copy of the license at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package termbox is a compatibility layer to allow tcell to emulate
// the github.com/nsf/termbox package.
package termbox
// Ugly globals
// var screen tcell.Screen
// var outMode OutputMode
// func SetScreen(s tcell.Screen) {
// screen = s
// }
// Attribute affects the presentation of characters, such as color, boldness,
// and so forth.
type Attribute uint16
// Colors first. The order here is significant.
const (
ColorDefault Attribute = iota
ColorBlack
ColorRed
ColorGreen
ColorYellow
ColorBlue
ColorMagenta
ColorCyan
ColorWhite
)
// Other attributes.
// const (
// AttrBold Attribute = 1 << (9 + iota)
// AttrUnderline
// AttrReverse
// )
// Clear clears the screen with the given attributes.
// func Clear(fg, bg Attribute) {
// st := MkStyle(fg, bg)
// w, h := screen.Size()
// for row := 0; row < h; row++ {
// for col := 0; col < w; col++ {
// screen.SetContent(col, row, ' ', nil, st)
// }
// }
// }
// OutputMode represents an output mode, which determines how colors
// are used. See the termbox documentation for an explanation.
// type OutputMode int
// // OutputMode values.
// const (
// OutputCurrent OutputMode = iota
// OutputNormal
// Output256
// Output216
// OutputGrayscale
// )
// SetOutputMode is used to set the color palette used.
// func SetOutputMode(mode OutputMode) OutputMode {
// if screen.Colors() < 256 {
// mode = OutputNormal
// }
// switch mode {
// case OutputCurrent:
// return outMode
// case OutputNormal, Output256, Output216, OutputGrayscale:
// outMode = mode
// return mode
// default:
// return outMode
// }
// }
// scaledColor returns a Color that is proportional to the x/y coordinates
// func scaledColor(x, y int) tcell.Color {
// w, h := screen.Size()
// blu := int32(255 * float64(x) / float64(w))
// grn := int32(255 * float64(y) / float64(h))
// red := int32(200)
// return tcell.NewRGBColor(red, grn, blu)
// }
// PollEvent blocks until an event is ready, and then returns it.
// func PollEvent() tcell.Event {
// return screen.PollEvent()
// }

@ -8,8 +8,6 @@ import (
"regexp"
"strings"
tm "github.com/cointop-sh/cointop/pkg/termbox"
rw "github.com/mattn/go-runewidth"
)
@ -48,9 +46,9 @@ var (
/* ----------------------- End ----------------------------- */
func toTmAttr(x Attribute) tm.Attribute {
return tm.Attribute(x)
}
// func toTmAttr(x Attribute) tm.Attribute {
// return tm.Attribute(x)
// }
func str2runes(s string) []rune {
return []rune(s)

Loading…
Cancel
Save