Fixed info window Interface update
This commit is contained in:
parent
d5f357f025
commit
205138b53b
@ -25,19 +25,11 @@ func (l *FixedInfoWindow) GetLines(count int) []string {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *FixedInfoWindow) AddLine(line *string) error {
|
func (l *FixedInfoWindow) RequestLine(line int) *string {
|
||||||
if len(l.lines) <= l.maxLines {
|
if line < 0 || line > l.maxLines-1 {
|
||||||
l.lines = append(l.lines, line)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
return l.lines[line]
|
||||||
for i, il := range l.lines {
|
|
||||||
if il != nil {
|
|
||||||
l.lines[i] = line
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return fmt.Errorf("No free lines")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *FixedInfoWindow) Clear() {
|
func (l *FixedInfoWindow) Clear() {
|
||||||
@ -51,13 +43,16 @@ func (l *FixedInfoWindow) ClearLine(line int) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
l.lines[line] = nil
|
l.lines[line] = new(string)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFixedInfoWindow(lines int) *FixedInfoWindow {
|
func NewFixedInfoWindow(lines int) *FixedInfoWindow {
|
||||||
ret := new(FixedInfoWindow)
|
ret := new(FixedInfoWindow)
|
||||||
ret.lines = []*string{}
|
ret.lines = []*string{}
|
||||||
ret.maxLines = lines
|
ret.maxLines = lines
|
||||||
|
for i := 0; i < ret.maxLines; i++ {
|
||||||
|
ret.lines = new(string)
|
||||||
|
}
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user