mirror of https://github.com/jroimartin/gocui.git
Add View.Buffer()
This commit is contained in:
parent
4c22f4abd9
commit
9f2bfa7213
10
view.go
10
view.go
|
@ -241,6 +241,16 @@ func (v *View) addLine(y int) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Buffer returns a string with the contents of the view's internal
|
||||||
|
// buffer
|
||||||
|
func (v *View) Buffer() string {
|
||||||
|
str := ""
|
||||||
|
for _, l := range v.lines {
|
||||||
|
str += string(l) + "\n"
|
||||||
|
}
|
||||||
|
return strings.Replace(str, "\x00", " ", -1)
|
||||||
|
}
|
||||||
|
|
||||||
// Line returns a string with the line of the view's internal buffer
|
// Line returns a string with the line of the view's internal buffer
|
||||||
// at the position corresponding to the point (x, y).
|
// at the position corresponding to the point (x, y).
|
||||||
func (v *View) Line(y int) (string, error) {
|
func (v *View) Line(y int) (string, error) {
|
||||||
|
|
Loading…
Reference in New Issue