From d4d061b31e28826d0b5ea37c24ef5570d61d7071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lilian=20J=C3=B3nsd=C3=B3ttir?= Date: Sat, 29 Jun 2024 19:54:15 -0700 Subject: [PATCH] what even is consistency --- internal/tables/tables.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/tables/tables.go b/internal/tables/tables.go index cca0e0f..6d81c40 100644 --- a/internal/tables/tables.go +++ b/internal/tables/tables.go @@ -243,17 +243,17 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { case tea.KeyMsg: switch { case key.Matches(msg, m.keys.mark): - m.toggle_item(m.table.Cursor()) + m.toggleItem(m.table.Cursor()) case key.Matches(msg, m.keys.doit): if !m.readonly && m.mode != modes.Interactive { return m, tea.Quit } case key.Matches(msg, m.keys.nada): - m.unselect_all() + m.unselectAll() case key.Matches(msg, m.keys.todo): - m.select_all() + m.selectAll() case key.Matches(msg, m.keys.invr): - m.invert_selection() + m.invertSelection() case key.Matches(msg, m.keys.clen): if m.mode == modes.Interactive { m.mode = modes.Cleaning @@ -351,14 +351,14 @@ func (m model) footer() string { func (m model) quit(unselect_all bool) (model, tea.Cmd) { if unselect_all { - m.unselect_all() + m.unselectAll() } m.table.SetStyles(makeUnselectedStyle()) return m, tea.Quit } -// update_row updates row of `index` with `row` -func (m *model) update_row(index int, selected bool) { +// updateRow updates row of `index` with `row` +func (m *model) updateRow(index int, selected bool) { rows := m.table.Rows() row := rows[index] rows[index] = table.Row{ @@ -372,7 +372,7 @@ func (m *model) update_row(index int, selected bool) { m.table.SetRows(rows) } -func (m *model) update_rows(selected bool) { +func (m *model) updateRows(selected bool) { var newrows []table.Row for _, row := range m.table.Rows() { @@ -388,8 +388,8 @@ func (m *model) update_rows(selected bool) { m.table.SetRows(newrows) } -// toggle_item toggles an item's selected state, and returns the state -func (m *model) toggle_item(index int) (selected bool) { +// toggleItem toggles an item's selected state, and returns the state +func (m *model) toggleItem(index int) (selected bool) { if m.readonly { return false } @@ -406,11 +406,11 @@ func (m *model) toggle_item(index int) (selected bool) { } // update the rows with the state - m.update_row(index, selected) + m.updateRow(index, selected) return } -func (m *model) select_all() { +func (m *model) selectAll() { if m.readonly { return } @@ -419,19 +419,19 @@ func (m *model) select_all() { for i := range len(m.table.Rows()) { m.selected[i] = true } - m.update_rows(true) + m.updateRows(true) } -func (m *model) unselect_all() { +func (m *model) unselectAll() { if m.readonly { return } m.selected = map[int]bool{} - m.update_rows(false) + m.updateRows(false) } -func (m *model) invert_selection() { +func (m *model) invertSelection() { var newrows []table.Row for index, row := range m.table.Rows() {