Display displays this terminal in a view
()
| 65 | |
| 66 | // Display displays this terminal in a view |
| 67 | func (w *TermWindow) Display() { |
| 68 | w.State.Lock() |
| 69 | defer w.State.Unlock() |
| 70 | |
| 71 | var l buffer.Loc |
| 72 | for y := 0; y < w.Height; y++ { |
| 73 | for x := 0; x < w.Width; x++ { |
| 74 | l.X, l.Y = x, y |
| 75 | c, f, b := w.State.Cell(x, y) |
| 76 | |
| 77 | fg, bg := int(f), int(b) |
| 78 | if f == terminal.DefaultFG { |
| 79 | fg = int(tcell.ColorDefault) |
| 80 | } |
| 81 | if b == terminal.DefaultBG { |
| 82 | bg = int(tcell.ColorDefault) |
| 83 | } |
| 84 | st := tcell.StyleDefault.Foreground(config.GetColor256(fg)).Background(config.GetColor256(bg)) |
| 85 | |
| 86 | if l.LessThan(w.Selection[1]) && l.GreaterEqual(w.Selection[0]) || l.LessThan(w.Selection[0]) && l.GreaterEqual(w.Selection[1]) { |
| 87 | st = st.Reverse(true) |
| 88 | } |
| 89 | |
| 90 | screen.SetContent(w.X+x, w.Y+y, c, nil, st) |
| 91 | } |
| 92 | } |
| 93 | if config.GetGlobalOption("statusline").(bool) { |
| 94 | statusLineStyle := config.DefStyle.Reverse(true) |
| 95 | if style, ok := config.Colorscheme["statusline"]; ok { |
| 96 | statusLineStyle = style |
| 97 | } |
| 98 | |
| 99 | text := []byte(w.Name()) |
| 100 | textLen := util.CharacterCount(text) |
| 101 | for x := 0; x < w.Width; x++ { |
| 102 | if x < textLen { |
| 103 | r, combc, size := util.DecodeCharacter(text) |
| 104 | text = text[size:] |
| 105 | screen.SetContent(w.X+x, w.Y+w.Height, r, combc, statusLineStyle) |
| 106 | } else { |
| 107 | screen.SetContent(w.X+x, w.Y+w.Height, ' ', nil, statusLineStyle) |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | if w.State.CursorVisible() && w.active { |
| 112 | curx, cury := w.State.Cursor() |
| 113 | if curx < w.Width && cury < w.Height { |
| 114 | screen.ShowCursor(curx+w.X, cury+w.Y) |
| 115 | } |
| 116 | } |
| 117 | } |
nothing calls this directly
no test coverage detected