Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed var name from 'str' to 's' for uniformity #956

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/glamour/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ func newExample() (*example, error) {
return nil, err
}

str, err := renderer.Render(content)
s, err := renderer.Render(content)
if err != nil {
return nil, err
}

vp.SetContent(str)
vp.SetContent(s)

return &example{
viewport: vp,
Expand Down
4 changes: 2 additions & 2 deletions examples/list-simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list
return
}

str := fmt.Sprintf("%d. %s", index+1, i)
s := fmt.Sprintf("%d. %s", index+1, i)

fn := itemStyle.Render
if index == m.Index() {
Expand All @@ -46,7 +46,7 @@ func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list
}
}

fmt.Fprint(w, fn(str))
fmt.Fprint(w, fn(s))
}

type model struct {
Expand Down
6 changes: 3 additions & 3 deletions examples/spinner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ func (m model) View() string {
if m.err != nil {
return m.err.Error()
}
str := fmt.Sprintf("\n\n %s Loading forever...press q to quit\n\n", m.spinner.View())
s := fmt.Sprintf("\n\n %s Loading forever...press q to quit\n\n", m.spinner.View())
if m.quitting {
return str + "\n"
return s + "\n"
}
return str
return s
}

func main() {
Expand Down
6 changes: 3 additions & 3 deletions key.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type KeyMsg Key

// String returns a string representation for a key message. It's safe (and
// encouraged) for use in key comparison.
func (k KeyMsg) String() (str string) {
func (k KeyMsg) String() (s string) {
return Key(k).String()
}

Expand All @@ -64,7 +64,7 @@ type Key struct {
// k := Key{Type: KeyEnter}
// fmt.Println(k)
// // Output: enter
func (k Key) String() (str string) {
func (k Key) String() (s string) {
var buf strings.Builder
if k.Alt {
buf.WriteString("alt+")
Expand Down Expand Up @@ -107,7 +107,7 @@ func (k Key) String() (str string) {
// }
type KeyType int

func (k KeyType) String() (str string) {
func (k KeyType) String() (s string) {
if s, ok := keyNames[k]; ok {
return s
}
Expand Down
4 changes: 2 additions & 2 deletions mouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ const (
//
// https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Extended-coordinates
func parseSGRMouseEvent(buf []byte) MouseEvent {
str := string(buf[3:])
matches := mouseSGRRegex.FindStringSubmatch(str)
s := string(buf[3:])
matches := mouseSGRRegex.FindStringSubmatch(s)
if len(matches) != 5 { //nolint:gomnd
// Unreachable, we already checked the regex in `detectOneMsg`.
panic("invalid mouse event")
Expand Down