Skip to content
Myr

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 file

Take 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 back
1package tea
2

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

lines 3–4why, one step back
3import "github.com/charmbracelet/x/ansi"
4

feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9

line 5why, one step back
5// WindowSizeMsg is used to report the terminal size. It's sent to Update once

chore: remove deprecated windows note (#1695)Jasonbefore adoptionaf9a33e

line 6why, one step back
6// initially and then on every terminal resize.

feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9

lines 7–25why, one step back
7type 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{}25

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

line 26why, one step back
26// ModeReportMsg is a message that represents a mode report event (DECRPM).

chore: revert "Remove irrelevant option comments"Ayman Bagabasbefore adoptionee7cf45

line 27why, one step back
27//

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

lines 28–30why, one step back
28// This is sent by the terminal in response to a request for a terminal mode
29// 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 back
31//

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

line 32why, one step back
32// Example:

chore: revert "Remove irrelevant option comments"Ayman Bagabasbefore adoptionee7cf45

line 33why, one step back
33//

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

lines 34–38why, one step back
34// ```go
35// 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 back
39//

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

lines 40–49why, one step back
40// 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 back
50//

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

lines 51–57why, one step back
51// 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 back
58//

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

lines 59–62why, one step back
59// See: https://vt100.net/docs/vt510-rm/DECRPM.html
60type ModeReportMsg struct {61 // Mode is the mode number.62 Mode ansi.Mode

feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9

line 63why, one step back
63

Merge pull request #1118 from charmbracelet/v2-expAyman Bagabasbefore adoptiond1c8c97

lines 64–65why, one step back
64 // Value is the mode value.
65 Value ansi.ModeSetting

feat(render): skipping lines from previous frameKonstantin Antonovbefore adoption3dfbcd9

line 66why, one step back
66}