awesome-gocui / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
344 stars 39 forks source link

[BUG] Exits on Open #44

Closed Rudi9719 closed 4 years ago

Rudi9719 commented 4 years ago

Describe the bug After converting from jroimartin/gocui to awesome-gocui (adding params to g.NewGui(), and g.SetView()) my projectnow exits cleanly upon opening rather than starting the main loop.

To Reproduce Steps to reproduce the behavior:

  1. Compile project
  2. Start Project

Expected behavior TUI with 4 views should appear, and populate with text as they did with jroimartin/gocui

Screenshots N/A

Environment (please complete the following information):

Additional context https://github.com/Rudi9719/kbtui/tree/awesome-gocui

I began migrating to this (maintained) fork of gocui to implement features that were missing from the original, however it looks like it just closes after gocui.NewGui() it doesn't return the normal tuple, and just exits.

mjarkk commented 4 years ago

Thanks for creating the issue,
i'll look into your project later today and see if we can fix your issue.

mjarkk commented 4 years ago

I've looked into your code and found the problem.
We do the unknown view check a bit different than the original repo, in your layout function change these checks:

// from this:
if err != gocui.ErrUnknownView {
  return err
}

// to this:
if !gocui.IsUnknownView(err) {
  return err
}

This this behavior can also be found in the example projects: _examples/layout.go#L15

mjarkk commented 4 years ago

I've created a pr in your repo to fix the problem: https://github.com/Rudi9719/kbtui/pull/1

Rudi9719 commented 4 years ago

Thanks! Merged in