skanehira/docui

[Bug] Enable to run docui on small terminal window

gotchane opened this issue · 5 comments

Thanks for creating docui. This project is awesome!
I would like to ask a question.

When I use docui on tmux + iTerm2 on Mac OSX, but the error below happened.

panic: invalid dimensions

goroutine 1 [running]:
github.com/skanehira/docui/panel.(*Gui).init(0xc4205fe240)
        /Users/gotchane/go/src/github.com/skanehira/docui/panel/gui.go:198 +0xece
github.com/skanehira/docui/panel.New(0x2, 0xc4205b3f78)
        /Users/gotchane/go/src/github.com/skanehira/docui/panel/gui.go:94 +0x150
main.main()
        /Users/gotchane/go/src/github.com/skanehira/docui/main.go:13 +0x2eanic: invalid dimensions

However, according to issue #66, it works fine when I increase window size.

If possible, I would like to fix this issue, could I? (However I'm newbie of golang...)

If there are already some outlines of fixing this issue, I'll follow them.

Any comments are welcome.

@gotchane
Thank you issue.
When gocui run, it will get terminal window size and use it to create panel.
If window size is too small, cannot create panel because cannot secure the area to be displayed.

Since this problem cannot be solved on the docui, it can be avoided by increasing the terminal windows size or decreasing the terminal font size.

Thanks for your reply 😃
I understood the reason why this issue happens.

Even though it’s just an idea, I think there are several approaches to solve this issue.

If the window size is small:

  1. view smaller font size
  2. view partially (ex: only task list/image list…)
  3. view only the visible range from upper left in the window size
  4. raise error message (ex: 'docui requires large window size (over 000px x 000px).')

What do you think about that? 
Which is better, or is there any approaches?

@gotchane
Thank you.
I think this is good idea!

4. raise error message (ex: 'docui requires large window size (over 000px x 000px).')

Would you give me a PR?
If it difficult I'll do it.

Thanks! I try to do it and send a PR!