screenText is the terminal's screen as text, without trailing spaces or blank lines at the bottom.
(term vt10x.Terminal)
| 126 | // screenText is the terminal's screen as text, without trailing spaces or |
| 127 | // blank lines at the bottom. |
| 128 | func screenText(term vt10x.Terminal) string { |
| 129 | lines := strings.Split(term.String(), "\n") |
| 130 | for i, line := range lines { |
| 131 | lines[i] = strings.TrimRight(line, " ") |
| 132 | } |
| 133 | for len(lines) > 0 && lines[len(lines)-1] == "" { |
| 134 | lines = lines[:len(lines)-1] |
| 135 | } |
| 136 | if len(lines) == 0 { |
| 137 | return "" |
| 138 | } |
| 139 | return strings.Join(lines, "\n") + "\n" |
| 140 | } |
| 141 | |
| 142 | // lockedWriter lets ghmock's typing and the terminal's answers to gh share |
| 143 | // the pseudo-terminal without interleaving. |
no test coverage detected