Skip to content

Commit

Permalink
fix view refresh on main view pane selection (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
sambukowski committed Jul 11, 2024
1 parent 36fcb9e commit 628c2db
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions modules/cli/internal/ui/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (a *App) SetView(view string, p Props) {
// newly rendered view as the root.
func (a *App) RefreshView(p Props) {
a.Application.SetInputCapture(nil)
a.Application.SetMouseCapture(nil)
a.Application.SetInputCapture(a.view.GetKeyboard(a))
a.Application.SetRoot(a.view.Render(p), true)
}
7 changes: 4 additions & 3 deletions modules/cli/internal/ui/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,12 @@ func (mv *MainView) GetKeyboard(a AppController) func(evt *tcell.EventKey) *tcel
// we want the down key to increment the selected index,
// bc top pane starts at 0
mv.incrementSelectedPaneIdx()
a.RefreshView(nil)

case tcell.KeyUp:
mv.decrementSelectedPaneIdx()
a.RefreshView(nil)

case tcell.KeyEnter:
a.SetView("fullscreen", mv.processPanes[mv.selectedPaneIdx])
default:
Expand Down Expand Up @@ -221,9 +225,6 @@ func (fv *FullscreenView) Render(p Props) *tview.Flex {
SetChangedFunc(func() {
fv.tApp.Draw()
})
// update the shared state for the process pane
fv.processPane.SetIsBorderless(fv.s.GetIsBorderless())
fv.processPane.SetIsWordWrap(fv.s.GetIsWordWrap())
flex := tview.NewFlex().AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
AddItem(info, 4, 0, true).
AddItem(fv.processPane.GetTextView(), 0, 1, true).
Expand Down

0 comments on commit 628c2db

Please sign in to comment.