awesome-gocui / gocui

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

[BUG] [REGRESSION] First line not rendered on MinGW #105

Closed coloursofnoise closed 2 years ago

coloursofnoise commented 2 years ago

Describe the bug The first line of the UI is cut off, and an extra empty line is added to the end when running on MinGW.

To Reproduce Steps to reproduce the behavior:

  1. Use the latest version of awesome-gocui/gocui (v1.0.1)
  2. Use g.SetView("test", 0, 0, maxX-1, maxY-1, 0) to create a view that should surround the terminal
  3. Run the program (using winpty, see #43)

Expected behavior A border lining the terminal

Screenshots image scrolling up shows that the first line is indeed cut off image

Environment (please complete the following information):

Additional context Could not reproduce issue on native linux Issue is not present when version v0.6.1-0.20191115151952-a34ffb055986 is pinned (version used by git bug) (a34ffb055986a3f9461735162c9a2d235b95b8cb)

dankox commented 2 years ago

I do not have Windows 7 by my side to test it, but I remember this problem when I was trying new tcell implementation and was bugging me quite a bit. It is described in the PR and also a little bit in the documentation: https://github.com/awesome-gocui/gocui/blob/master/migrate-to-v1.md#outputmode

also this comment in the original PR is about this problem: https://github.com/awesome-gocui/gocui/pull/73#issuecomment-723661015

The idea is that you setup TCELL_TRUECOLOR variable to disable.

However, reading thru the PR comments, I found out that this was later fixed in tcell and we didn't include it because it wasn't tagged.
Right now, it is in tagged version so we could probably update the tcell package.

Can you test it if it works for you? Just update the go.mod file like this:

module github.com/awesome-gocui/gocui

go 1.13

require (
    github.com/gdamore/tcell/v2 v2.4.0
    github.com/mattn/go-runewidth v0.0.9
    golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
    golang.org/x/text v0.3.3 // indirect
)

Updating to 2.4 version should be good enough. If it doesn't work for whatever reason, then maybe just v2.1.0

If it would work, I would create PR to get it in.

coloursofnoise commented 2 years ago

It seems to be fixed on both v2.1.0 and v2.4.0 of tcell. If there's nothing else that would need to be changed with updating it, I can submit a PR to update to v2.4.0.

dankox commented 2 years ago

Go for it. Also sorry for late answer :)

If you wouldn't mind and you would do the fix, can you also run thru the _examples directory and check if any of those programs are affected or not? I don't think it would happen (I checked what was added/fixed in tcell and all looks ok), but just to be sure.