// Fenrir console screen reader. // Copyright (c) 2026 Storm Dragon // SPDX-License-Identifier: GPL-3.0-or-later // // This program is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software Foundation, either version 3 of the License, or (at your option) // any later version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for // more details. // // You should have received a copy of the GNU General Public License along with // this program. If not, see . // Package screen describes the visible cells of one terminal session. package screen import "strings" type Snapshot struct { Terminal int // Generation changes when a terminal replaces its logical screen buffer. Generation uint64 Active bool NumLock bool CapsLock bool Rows, Cols int X, Y int Cells []rune // Attributes is either absent or has one entry per cell. Both adapters keep // visual changes even when the text and hardware cursor stay unchanged. Attributes []Attribute } type Attribute struct { Foreground, Background uint32 Style uint32 } func (s Snapshot) Line(row int) []rune { return s.Cells[row*s.Cols : (row+1)*s.Cols] } func (s Snapshot) Text(row int) string { return strings.TrimRight(string(s.Line(row)), " \x00") }