mirror of
https://github.com/charmbracelet/gum
synced 2024-06-08 16:52:17 +02:00
respond to soft lint warnings
This commit is contained in:
parent
59e3457c98
commit
8102a3d10a
|
@ -48,7 +48,7 @@ func (m *model) ProcessText(msg tea.WindowSizeMsg) {
|
|||
textStyle := lipgloss.NewStyle().Width(m.viewport.Width)
|
||||
var text strings.Builder
|
||||
|
||||
// Determine max width of a line
|
||||
// Determine max width of a line.
|
||||
m.maxWidth = m.viewport.Width
|
||||
if m.softWrap {
|
||||
vpStyle := m.viewport.Style
|
||||
|
@ -93,7 +93,7 @@ func (m model) KeyHandler(key tea.KeyMsg) (model, func() tea.Msg) {
|
|||
m.content = m.origContent
|
||||
m.search.Execute(&m)
|
||||
|
||||
// Trigger a view update to highlight the found matches
|
||||
// Trigger a view update to highlight the found matches.
|
||||
m.search.NextMatch(&m)
|
||||
m.ProcessText(tea.WindowSizeMsg{Height: m.viewport.Height + 2, Width: m.viewport.Width})
|
||||
} else {
|
||||
|
|
|
@ -31,7 +31,7 @@ func (s *search) Begin() {
|
|||
s.input.Focus()
|
||||
}
|
||||
|
||||
// Execute find all lines in the model with a match
|
||||
// Execute find all lines in the model with a match.
|
||||
func (s *search) Execute(m *model) {
|
||||
defer s.Done()
|
||||
if s.input.Value() == "" {
|
||||
|
@ -94,7 +94,7 @@ func (s *search) NextMatch(m *model) {
|
|||
}
|
||||
}
|
||||
|
||||
// Only update if the match is not within the viewport
|
||||
// Only update if the match is not within the viewport.
|
||||
if line > m.viewport.YOffset+m.viewport.VisibleLineCount()-1 || line < m.viewport.YOffset {
|
||||
m.viewport.SetYOffset(line)
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ func (s *search) PrevMatch(m *model) {
|
|||
}
|
||||
}
|
||||
|
||||
// Only update if the match is not within the viewport
|
||||
// Only update if the match is not within the viewport.
|
||||
if line > m.viewport.YOffset+m.viewport.VisibleLineCount()-1 || line < m.viewport.YOffset {
|
||||
m.viewport.SetYOffset(line)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue