Render flushes the state objects (file tree) to the pane.
()
| 416 | |
| 417 | // Render flushes the state objects (file tree) to the pane. |
| 418 | func (v *FileTree) Render() error { |
| 419 | logrus.Tracef("view.Render() %s", v.Name()) |
| 420 | |
| 421 | title := v.title |
| 422 | isSelected := v.gui.CurrentView() == v.view |
| 423 | |
| 424 | v.gui.Update(func(g *gocui.Gui) error { |
| 425 | // update the header |
| 426 | v.header.Clear() |
| 427 | width, _ := g.Size() |
| 428 | headerStr := format.RenderHeader(title, width, isSelected) |
| 429 | if v.vm.ShowAttributes { |
| 430 | headerStr += fmt.Sprintf(filetree.AttributeFormat+" %s", "P", "ermission", "UID:GID", "Size", "Filetree") |
| 431 | } |
| 432 | _, _ = fmt.Fprintln(v.header, headerStr) |
| 433 | |
| 434 | // update the contents |
| 435 | v.view.Clear() |
| 436 | err := v.vm.Render() |
| 437 | if err != nil { |
| 438 | return err |
| 439 | } |
| 440 | _, err = fmt.Fprint(v.view, v.vm.Buffer.String()) |
| 441 | |
| 442 | return err |
| 443 | }) |
| 444 | return nil |
| 445 | } |
| 446 | |
| 447 | // KeyHelp indicates all the possible actions a user can take while the current pane is selected. |
| 448 | func (v *FileTree) KeyHelp() string { |
no test coverage detected