diff --git a/gshmm.go b/gshmm.go index 2e4a9bf..d125d33 100644 --- a/gshmm.go +++ b/gshmm.go @@ -29,10 +29,6 @@ const minCharsUntilFilter = 2 var helpFlag bool -type Configuration struct { - ManualDir string -} - func handleCliFlags() { flag.BoolVar(&helpFlag, "h", false, "output help") flag.Parse() @@ -112,6 +108,7 @@ func initialModel() model { return nil }) + // TODO: set width/heigh to match terminal viewp := viewport.New(60, 30) viewp.SetContent(ds[len(ds)-1].contents) @@ -120,7 +117,6 @@ func initialModel() model { datasheets: ds, dataSheetViewport: viewp, } - // TODO: which index is the datasheet closest to the filter input? m.dataSheetsView = m.dataSheetNames() return m @@ -155,11 +151,15 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.dataSheetsView = m.dataSheetNames() } + // TODO: implement cursor for scrolling up/down filtered + // results so we can view the PDF contents as desired + // it's currently just the last one (closed to input) lastDatasheet := m.dataSheetsView[len(m.dataSheetsView)-1] viewportText := m.datasheetFromName(lastDatasheet) m.dataSheetViewport.SetContent(viewportText) } + // TODO: handle terminal resizing switch msg := msg.(type) { case tea.KeyMsg: switch msg.String() { @@ -171,8 +171,6 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.filterInput, cmd = m.filterInput.Update(msg) cmds = append(cmds, cmd) - // TODO figure out how update viewport when filtering - // the last item in m.dataSheetsView should be shown m.dataSheetViewport, cmd = m.dataSheetViewport.Update(msg) cmds = append(cmds, cmd)