(m *TuiModel)
| 24 | } |
| 25 | |
| 26 | func SelectOption(m *TuiModel) { |
| 27 | if m.UI.RenderSelection { |
| 28 | return |
| 29 | } |
| 30 | |
| 31 | m.UI.RenderSelection = true |
| 32 | raw, _, col := m.GetSelectedOption() |
| 33 | if raw == nil { |
| 34 | return |
| 35 | } |
| 36 | l := len(col) |
| 37 | row := m.Viewport.YOffset + m.MouseData.Y - HeaderHeight |
| 38 | |
| 39 | if row <= l && l > 0 && |
| 40 | m.MouseData.Y >= HeaderHeight && |
| 41 | m.MouseData.Y < m.Viewport.Height+HeaderHeight && |
| 42 | m.MouseData.X < m.CellWidth()*(len(m.Data().TableHeadersSlice)) { |
| 43 | if conv, ok := (*raw).(string); ok { |
| 44 | m.Data().EditTextBuffer = conv |
| 45 | } else { |
| 46 | m.Data().EditTextBuffer = "" |
| 47 | } |
| 48 | } else { |
| 49 | m.UI.RenderSelection = false |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // ScrollDown is a simple function to move the Viewport down |
| 54 | func ScrollDown(m *TuiModel) { |
no test coverage detected