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

Ensure view.SetCursor doesn't set an invalid point when the view is empty #90

Closed NoF0rte closed 3 years ago

NoF0rte commented 3 years ago

Currently, if view.SetCursor is called on an empty view with a y > 0, the x and y values that are passed to view.SetCursorUnrestricted are 0 and -1 respectively which is an invalid point.

This change ensures that if the view is empty, the y value passed to view.SetCursorUnrestricted will be set to 0.