curses icon indicating copy to clipboard operation
curses copied to clipboard

Fix the signature of getstr and getnstr

Open seejohnrun opened this issue 1 year ago • 1 comments

The getstr and getnstr ncurses functions take in char * where they're expected to place the string retrieved from the blocking user input.

https://pubs.opengroup.org/onlinepubs/7908799/xcurses/getnstr.html

The current implementation in the OCaml Curses library maps these functions onto a function with signatures like string -> err which doesn't allow users to retrieve the strings generated from these function calls.

This commit changes the implementation of getstr to return a (string, unit) result which will allow users to get the produced string back while still allowing them to check the error state accurately.

I'm aware that other functions nearby these functions have the same issue, and I'm happy to update those as well if you're good with this approach.

seejohnrun avatar Aug 07 '24 05:08 seejohnrun

seems fine, thanks! be sure to add yourself to the CHANGES.md. I'd make an "UNRELEASED" header entry.

mbacarella avatar Aug 12 '24 15:08 mbacarella