mirror of https://github.com/gdamore/tcell.git
fixes #576 Intermittent screen flashes
This commit is contained in:
parent
44c298f729
commit
a642547922
11
screen.go
11
screen.go
|
@ -24,12 +24,13 @@ type Screen interface {
|
||||||
// Fini finalizes the screen also releasing resources.
|
// Fini finalizes the screen also releasing resources.
|
||||||
Fini()
|
Fini()
|
||||||
|
|
||||||
// Clear erases the screen. The contents of any screen buffers
|
// Clear logically erases the screen.
|
||||||
// will also be cleared. This has the logical effect of
|
// This is effectively a short-cut for Fill(' ', StyleDefault).
|
||||||
// filling the screen with spaces, using the global default style.
|
|
||||||
Clear()
|
Clear()
|
||||||
|
|
||||||
// Fill fills the screen with the given character and style.
|
// Fill fills the screen with the given character and style.
|
||||||
|
// The effect of filling the screen is not visible until Show
|
||||||
|
// is called (or Sync).
|
||||||
Fill(rune, Style)
|
Fill(rune, Style)
|
||||||
|
|
||||||
// SetCell is an older API, and will be removed. Please use
|
// SetCell is an older API, and will be removed. Please use
|
||||||
|
@ -42,7 +43,7 @@ type Screen interface {
|
||||||
// and may not actually be what is displayed, but rather are what will
|
// and may not actually be what is displayed, but rather are what will
|
||||||
// be displayed if Show() or Sync() is called. The width is the width
|
// be displayed if Show() or Sync() is called. The width is the width
|
||||||
// in screen cells; most often this will be 1, but some East Asian
|
// in screen cells; most often this will be 1, but some East Asian
|
||||||
// characters require two cells.
|
// characters and emoji require two cells.
|
||||||
GetContent(x, y int) (primary rune, combining []rune, style Style, width int)
|
GetContent(x, y int) (primary rune, combining []rune, style Style, width int)
|
||||||
|
|
||||||
// SetContent sets the contents of the given cell location. If
|
// SetContent sets the contents of the given cell location. If
|
||||||
|
@ -54,7 +55,7 @@ type Screen interface {
|
||||||
//
|
//
|
||||||
// The results are not displayed until Show() or Sync() is called.
|
// The results are not displayed until Show() or Sync() is called.
|
||||||
//
|
//
|
||||||
// Note that wide (East Asian full width) runes occupy two cells,
|
// Note that wide (East Asian full width and emoji) runes occupy two cells,
|
||||||
// and attempts to place character at next cell to the right will have
|
// and attempts to place character at next cell to the right will have
|
||||||
// undefined effects. Wide runes that are printed in the
|
// undefined effects. Wide runes that are printed in the
|
||||||
// last column will be replaced with a single width space on output.
|
// last column will be replaced with a single width space on output.
|
||||||
|
|
12
tscreen.go
12
tscreen.go
|
@ -575,18 +575,6 @@ func (t *tScreen) SetStyle(style Style) {
|
||||||
|
|
||||||
func (t *tScreen) Clear() {
|
func (t *tScreen) Clear() {
|
||||||
t.Fill(' ', t.style)
|
t.Fill(' ', t.style)
|
||||||
t.Lock()
|
|
||||||
t.clear = true
|
|
||||||
w, h := t.cells.Size()
|
|
||||||
// because we are going to clear (see t.clear) in the next cycle,
|
|
||||||
// let's also unmark the dirty bit so that we don't waste cycles
|
|
||||||
// drawing things that are already dealt with via the clear escape sequence.
|
|
||||||
for row := 0; row < h; row++ {
|
|
||||||
for col := 0; col < w; col++ {
|
|
||||||
t.cells.SetDirty(col, row, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
t.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *tScreen) Fill(r rune, style Style) {
|
func (t *tScreen) Fill(r rune, style Style) {
|
||||||
|
|
Loading…
Reference in New Issue