Thursday, 28 November 2013

Upcoming Changes in Goncurses 0.2

I wrote and maintain an ncurses wrapper library for the Go programming language. Much like this blog, it went through a long dormancy with a few minor spurts of action while I was wrapped up in my regular job and my family. Back in June I finally tagged version 0.1.

Since that time I've implemented a fair number of changes and, as I warned at the time, a couple are somewhat breaking. The library is quite young as far as implementation goes and I want to avoid any API breaking changes if I can but I felt these were necessary.

Here is a list of changes coming up in 0.2:

Breaking Changes
  • As I announced in the 0.1 release, the Print statement has now been broken up into separate Print and MovePrint functions to be more ncurses-like and each has been further separated to be more Go-like: Print,  Println, Printf, MovePrint, MovePrintln, and MovePrintf. A regex replacement ought to fix most instances but some manual editing will probably be required.
  • The Character type has been changed to the shorter Char type. A simple gofmt or sed regex will easily fix any existing code.
  • Several functions now use the Char type like: AttrOn, AttrOff, Box, Border,ColorPair,  etc
  • Color related functions now take an int16 rather than an int (32bit) type. This is to mirror the C short type to protect against any type conversion errors.
Non-Breaking Changes
  • Implemented the slk soft-keys functions.
  • Added screen functions (newterm, set_term, etc).
  • Implemented a StdScr function which returns the underlying stdscr window object. This was mainly a requirement to using the screen functions because there was no other way to get the stdscr but it may be useful for other situations.
  • Implemented AttrSet, Standend and Standout text attribute functions.
  • Implemented Timeout for input on Windows