Screen represents the physical (or emulated) screen. This can be a terminal window or a physical console. Platforms implement this differently.
| 24 | // This can be a terminal window or a physical console. Platforms implement |
| 25 | // this differently. |
| 26 | type Screen interface { |
| 27 | // Init initializes the screen for use. |
| 28 | Init() error |
| 29 | |
| 30 | // Fini finalizes the screen also releasing resources. |
| 31 | Fini() |
| 32 | |
| 33 | // Clear logically erases the screen. |
| 34 | // This is effectively a short-cut for Fill(' ', StyleDefault). |
| 35 | Clear() |
| 36 | |
| 37 | // Fill fills the screen with the given character and style. |
| 38 | // The effect of filling the screen is not visible until Show |
| 39 | // is called (or Sync). |
| 40 | Fill(rune, Style) |
| 41 | |
| 42 | // Put writes the first grapheme of the given string with th |
| 43 | // given style at the given coordinates. (Only the first grapheme |
| 44 | // occupying either one or two cells is stored.) It returns the |
| 45 | // remainder of the string, and the width displayed. |
| 46 | Put(x int, y int, str string, style Style) (string, int) |
| 47 | |
| 48 | // PutStr writes a string starting at the given position, using the |
| 49 | // default style. The content is clipped to the screen dimensions. |
| 50 | PutStr(x int, y int, str string) |
| 51 | |
| 52 | // PutStrStyled writes a string starting at the given position, using |
| 53 | // the given style. The content is clipped to the screen dimensions. |
| 54 | PutStrStyled(x int, y int, str string, style Style) |
| 55 | |
| 56 | // Get the contents at the given location. If the |
| 57 | // coordinates are out of range, then the values will be 0, nil, |
| 58 | // StyleDefault. Note that the contents returned are logical contents |
| 59 | // and may not actually be what is displayed, but rather are what will |
| 60 | // be displayed if Show() or Sync() is called. The width is the width |
| 61 | // in screen cells; most often this will be 1, but some East Asian |
| 62 | // characters and emoji require two cells. |
| 63 | Get(x, y int) (str string, style Style, width int) |
| 64 | |
| 65 | // SetContent sets the contents of the given cell location. If |
| 66 | // the coordinates are out of range, then the operation is ignored. |
| 67 | // |
| 68 | // The first rune is the primary non-zero width rune. The array |
| 69 | // that follows is a possible list of combining characters to append, |
| 70 | // and will usually be nil (no combining characters.) |
| 71 | // |
| 72 | // The results are not displayed until Show() or Sync() is called. |
| 73 | // |
| 74 | // Note that wide (East Asian full width and emoji) runes occupy two cells, |
| 75 | // and attempts to place character at next cell to the right will have |
| 76 | // undefined effects. Wide runes that are printed in the |
| 77 | // last column will be replaced with a single width space on output. |
| 78 | SetContent(x int, y int, primary rune, combining []rune, style Style) |
| 79 | |
| 80 | // SetStyle sets the default style to use when clearing the screen |
| 81 | // or when StyleDefault is specified. If it is also StyleDefault, |
| 82 | // then whatever system/terminal default is relevant will be used. |
| 83 | SetStyle(style Style) |
no outgoing calls
no test coverage detected
searching dependent graphs…