diff --git a/terminal/cursor.go b/terminal/cursor.go index c294ca4c..1bc427c9 100644 --- a/terminal/cursor.go +++ b/terminal/cursor.go @@ -167,8 +167,11 @@ func (c *Cursor) Size(buf *bytes.Buffer) (*Coord, error) { // hide the cursor (so it doesn't blink when getting the size of the terminal) c.Hide() + defer c.Show() + // save the current location of the cursor c.Save() + defer c.Restore() // move the cursor to the very bottom of the terminal c.Move(999, 999) @@ -179,11 +182,6 @@ func (c *Cursor) Size(buf *bytes.Buffer) (*Coord, error) { return nil, err } - // move back where we began - c.Restore() - - // show the cursor - c.Show() // since the bottom was calculated in the lower right corner, it // is the dimensions we are looking for return bottom, nil