screen.go
This file
Path
screen.go
66 lines · 1.9 KiB · Go
Last changed by
chore: remove deprecated windows note (#1695)Jasonbefore adoptionaf9a33e
History of this fileTake it
The walk stopped after 200 commits: lines older than 3dfbcd9 point at it.
feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
lines 1–2why, one step back1package tea2Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
lines 3–4why, one step back3import "github.com/charmbracelet/x/ansi"4feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
line 5why, one step back5// WindowSizeMsg is used to report the terminal size. It's sent to Update oncechore: remove deprecated windows note (#1695)Jasonbefore adoptionaf9a33e
line 6why, one step back6// initially and then on every terminal resize.feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
lines 7–25why, one step back7type WindowSizeMsg struct {8 Width int9 Height int10}1112// ClearScreen is a special command that tells the program to clear the screen13// before the next update. This can be used to move the cursor to the top left14// of the screen and clear visual clutter when the alt screen is not in use.15//16// Note that it should never be necessary to call ClearScreen() for regular17// redraws.18func ClearScreen() Msg {19 return clearScreenMsg{}20}2122// clearScreenMsg is an internal message that signals to clear the screen.23// You can send a clearScreenMsg with ClearScreen.24type clearScreenMsg struct{}25Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
line 26why, one step back26// ModeReportMsg is a message that represents a mode report event (DECRPM).chore: revert "Remove irrelevant option comments"Ayman Bagabasbefore adoptionee7cf45
line 27why, one step back27//Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
lines 28–30why, one step back28// This is sent by the terminal in response to a request for a terminal mode29// report (DECRQM). It indicates the current setting of a specific terminal30// mode like cursor visibility, mouse tracking, etc.feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
line 31why, one step back31//Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
line 32why, one step back32// Example:chore: revert "Remove irrelevant option comments"Ayman Bagabasbefore adoptionee7cf45
line 33why, one step back33//Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
lines 34–38why, one step back34// ```go35// func (m model) Init() tea.Cmd {36// // Does my terminal support reporting focus events?37// return tea.Raw(ansi.RequestModeFocusEvent)38// }feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
line 39why, one step back39//Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
lines 40–49why, one step back40// func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {41// switch msg := msg.(type) {42// case tea.ModeReportMsg:43// if msg.Mode == ansi.ModeFocusEvent && !msg.Value.IsNotRecognized() {44// // Terminal supports focus events45// m.supportsFocus = true46// }47// }48// return m, nil49// }chore: revert "Remove irrelevant option comments"Ayman Bagabasbefore adoptionee7cf45
line 50why, one step back50//Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
lines 51–57why, one step back51// func (m model) View() tea.View {52// var view tea.View53// view.ReportFocus = m.supportsFocus54// view.SetContent(fmt.Sprintf("Terminal supports focus events: %v", m.supportsFocus))55// return view56// }57// ```feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
line 58why, one step back58//Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
lines 59–62why, one step back59// See: https://vt100.net/docs/vt510-rm/DECRPM.html60type ModeReportMsg struct {61 // Mode is the mode number.62 Mode ansi.Modefeat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
line 63why, one step back63Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97
lines 64–65why, one step back64 // Value is the mode value.65 Value ansi.ModeSettingfeat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9
line 66why, one step back66}