(model *picker.Model, cfg *config.Config, title string)
| 11 | ) |
| 12 | |
| 13 | func ConfigurePicker(model *picker.Model, cfg *config.Config, title string) { |
| 14 | model.Box = ui.ConfigureBox(tview.NewBox(), &cfg.Theme) |
| 15 | // When a child of the parent flex is focused, the parent layout itself is not reported as focused. |
| 16 | // Instead, the focused child (picker) is considered focused. |
| 17 | // Therefore, we manually set the active border style on the picker to ensure it displays the correct focused appearance. |
| 18 | model. |
| 19 | SetBlurFunc(nil). |
| 20 | SetFocusFunc(nil). |
| 21 | SetBorderSet(cfg.Theme.Border.ActiveSet.BorderSet). |
| 22 | SetBorderStyle(cfg.Theme.Border.ActiveStyle.Style). |
| 23 | SetTitleStyle(cfg.Theme.Title.ActiveStyle.Style). |
| 24 | SetFooterStyle(cfg.Theme.Footer.ActiveStyle.Style) |
| 25 | |
| 26 | model.SetTitle(title) |
| 27 | model.SetScrollBarVisibility(cfg.Theme.ScrollBar.Visibility.ScrollBarVisibility) |
| 28 | model.SetScrollBar(tview.NewScrollBar(). |
| 29 | SetTrackStyle(cfg.Theme.ScrollBar.TrackStyle.Style). |
| 30 | SetThumbStyle(cfg.Theme.ScrollBar.ThumbStyle.Style). |
| 31 | SetGlyphSet(cfg.Theme.ScrollBar.GlyphSet.GlyphSet)) |
| 32 | model.SetKeybinds(picker.Keybinds{ |
| 33 | Cancel: cfg.Keybinds.Picker.Cancel.Keybind, |
| 34 | Keybinds: list.Keybinds{ |
| 35 | SelectUp: cfg.Keybinds.Picker.SelectUp.Keybind, |
| 36 | SelectDown: cfg.Keybinds.Picker.SelectDown.Keybind, |
| 37 | SelectTop: cfg.Keybinds.Picker.SelectTop.Keybind, |
| 38 | SelectBottom: cfg.Keybinds.Picker.SelectBottom.Keybind, |
| 39 | }, |
| 40 | Select: cfg.Keybinds.Picker.Select.Keybind, |
| 41 | }) |
| 42 | } |
| 43 | |
| 44 | func humanJoin(items []string) string { |
| 45 | count := len(items) |
no test coverage detected